Overview
The base-size text embedding model from the second generation of Voyage AI models. Access to models is through Python API. You must register for Voyage API keys to access.
Voyage-02 is optimized for latency and quality and is part of the second-gen Voyage family. It includes a very reasonable context length of 4K tokens.
Using the model
Installation:
pip install -qU voyageai==0.2.1
Creating Embeddings:
import voyageai
voyageai.api_key = \"<<YOUR_VOYAGE_API_KEY>>\"
model_id = \"voyage-02-lite-instruct\"
def embed(docs: list[str]) -> list[list[float]]:
if len(docs) > 8:
raise ValueError(\"List of documents cannot be longer than 8\")
doc_embeds = voyageai.get_embeddings(docs, model=model_id)
return doc_embeds
doc_embeds = embed(docs)