Aleph Alpha
Aleph Alpha is a powerful language model that can generate human-like text. Aleph Alpha is capable of generating text in multiple languages and styles, and can be fine-tuned to generate text in specific domains.
If you’re opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.
%pip install llama-index-llms-alephalpha
!pip install llama-index
Set your Aleph Alpha token
Section titled “Set your Aleph Alpha token”import os
os.environ["AA_TOKEN"] = "your_token_here"
Call complete
with a prompt
Section titled “Call complete with a prompt”from llama_index.llms.alephalpha import AlephAlpha
# To customize your token, do this# otherwise it will lookup AA_TOKEN from your env variable# llm = AlephAlpha(token="<aa_token>")llm = AlephAlpha(model="luminous-base-control")
resp = llm.complete("Paul Graham is ")
print(resp)
a well-known computer scientist and entrepreneur. He is the co-founder of PayPal and a co-founder of the Y Combinator startup accelerator. He has also co-authored the book "Programming the Web". Paul Graham is also a frequent speaker and writer on topics related to computer science, entrepreneurship, and startups. He has written several blog posts on the topic of "Why Startups Fail". In this post, I will summarize some of the key points from Paul Graham's blog post on why startups fail.
1. Lack of a clear vision: Startups often lack a clear vision of what they
Additional Response Details
Section titled “Additional Response Details”To access detailed response information such as log probabilities, ensure your AlephAlpha instance is initialized with the log_probs
parameter. The logprobs
attribute of the CompletionResponse
will contain this data. Other details like the model version and raw completion text can be accessed directly if they’re part of the response or via additional_kwargs
.
from llama_index.llms.alephalpha import AlephAlpha
llm = AlephAlpha(model="luminous-base-control", log_probs=0)
resp = llm.complete("Paul Graham is ")
if resp.logprobs is not None: print("\nLog Probabilities:") for lp_list in resp.logprobs: for lp in lp_list: print(f"Token: {lp.token}, LogProb: {lp.logprob}")
if "model_version" in resp.additional_kwargs: print("\nModel Version:") print(resp.additional_kwargs["model_version"])
if "raw_completion" in resp.additional_kwargs: print("\nRaw Completion:") print(resp.additional_kwargs["raw_completion"])
Log Probabilities:Token: a, LogProb: -0.95955Token: well, LogProb: -1.9219251Token: -, LogProb: -0.1312752Token: known, LogProb: -0.022855662Token: computer, LogProb: -0.9569155Token: scientist, LogProb: -0.06721641Token: and, LogProb: -0.56296504Token: entrepreneur, LogProb: -0.65574974Token: ., LogProb: -0.5926046Token: He, LogProb: -0.1885516Token: is, LogProb: -0.3927348Token: the, LogProb: -0.46820825Token: co, LogProb: -0.465878Token: -, LogProb: -0.024082167Token: founder, LogProb: -0.009869587Token: of, LogProb: -0.31641242Token: PayPal, LogProb: -1.0825713Token: and, LogProb: -0.39408743Token: a, LogProb: -1.45493Token: co, LogProb: -1.0837904Token: -, LogProb: -0.0011430404Token: founder, LogProb: -0.074010715Token: of, LogProb: -0.038962167Token: the, LogProb: -1.7761776Token: Y, LogProb: -0.41853565Token: Combin, LogProb: -0.17868777Token: ator, LogProb: -2.0265374e-05Token: startup, LogProb: -0.24595682Token: acceler, LogProb: -0.5855012Token: ator, LogProb: -6.675698e-06Token: ., LogProb: -0.022597663Token: He, LogProb: -0.8310143Token: has, LogProb: -1.5842702Token: also, LogProb: -0.5774656Token: been, LogProb: -1.3938092Token: a, LogProb: -0.67207164Token: professor, LogProb: -1.0511048Token: at, LogProb: -0.13273911Token: the, LogProb: -0.7993539Token: MIT, LogProb: -1.2281163Token: Media, LogProb: -0.7707413Token: Lab, LogProb: -0.06716257Token: ., LogProb: -0.9140582Token: Paul, LogProb: -0.8244309Token: Graham, LogProb: -0.15202633Token: has, LogProb: -1.3735206Token: written, LogProb: -0.77148163Token: several, LogProb: -0.7167357Token: books, LogProb: -0.24542983Token: on, LogProb: -0.77700675Token: computer, LogProb: -0.8485363Token: science, LogProb: -0.026196867Token: and, LogProb: -0.4796574Token: entrepreneurs, LogProb: -0.48952234Token: hip, LogProb: -1.0847986e-05Token: ,, LogProb: -0.1426171Token: including, LogProb: -0.10799221Token: ", LogProb: -0.4733107Token: Program, LogProb: -0.9295699Token: ming, LogProb: -0.00090034Token: the, LogProb: -1.5219054Token: Universe, LogProb: -1.2475122Token: ", LogProb: -0.8377396Token: and, LogProb: -0.014596111Token: ", LogProb: -0.0034322182Token: The, LogProb: -0.97810173Token: Art, LogProb: -1.4708842Token: of, LogProb: -0.0017665509Token: Computer, LogProb: -0.027323013Token: Programming, LogProb: -0.09090222Token: "., LogProb: -0.2312944Token: He, LogProb: -0.9431941Token: is, LogProb: -0.52350885Token: also, LogProb: -0.8409716Token: the, LogProb: -1.2813272Token: founder, LogProb: -0.8080497Token: of, LogProb: -0.12735468Token: the, LogProb: -0.26858208Token: startup, LogProb: -1.7183943Token: incub, LogProb: -0.71643037Token: ator, LogProb: -0.00013922676Token: ,, LogProb: -1.6374074Token: Y, LogProb: -1.3464186Token: Combin, LogProb: -0.043204635Token: ator, LogProb: -1.490105e-05Token: ., LogProb: -0.48073012Token: <|endoftext|>, LogProb: -0.30235213
Model Version:20240215
Raw Completion: a well-known computer scientist and entrepreneur. He is the co-founder of PayPal and a co-founder of the Y Combinator startup accelerator. He has also been a professor at the MIT Media Lab. Paul Graham has written several books on computer science and entrepreneurship, including "Programming the Universe" and "The Art of Computer Programming". He is also the founder of the startup incubator, Y Combinator.
from llama_index.llms.alephalpha import AlephAlpha
llm = AlephAlpha(model="luminous-base-control")resp = await llm.acomplete("Paul Graham is ")
print(resp)
a computer scientist and entrepreneur who is known for his work in the field of artificial intelligence and computer science. He is the co-founder of the company Y Combinator, which is a startup accelerator that helps startups get funding and resources. Paul Graham has also written several books on computer science and entrepreneurship, including "Programming: Principles and Practice" and "The Art of Computer Programming". He is a well-known figure in the computer science community and has made significant contributions to the field.