docs/examples/embeddings/alephalpha.ipynb
<a href="https://colab.research.google.com/github/run-llama/llama_index/blob/main/docs/examples/embeddings/alephalpha.ipynb" target="_parent"></a>
If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.
%pip install llama-index-embeddings-alephalpha
!pip install llama-index
# Initialise with your AA token
import os
os.environ["AA_TOKEN"] = "your_token_here"
luminous-base embeddings.from llama_index.embeddings.alephalpha import AlephAlphaEmbedding
# To customize your token, do this
# otherwise it will lookup AA_TOKEN from your env variable
# embed_model = AlephAlpha(token="<aa_token>")
# with representation='query'
embed_model = AlephAlphaEmbedding(
model="luminous-base",
representation="Query",
)
embeddings = embed_model.get_text_embedding("Hello Aleph Alpha!")
print(len(embeddings))
print(embeddings[:5])
# with representation='Document'
embed_model = AlephAlphaEmbedding(
model="luminous-base",
representation="Document",
)
embeddings = embed_model.get_text_embedding("Hello Aleph Alpha!")
print(len(embeddings))
print(embeddings[:5])