Skip to main content

Documentation Index

Fetch the complete documentation index at: https://agno-v2-shaloo-ai-support-link.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

The VoyageAIEmbedder class is used to embed text data into vectors using the Voyage AI API. Get your key from here.

Usage

voyageai_embedder.py
from agno.knowledge.knowledge import Knowledge
from agno.vectordb.pgvector import PgVector
from agno.knowledge.embedder.voyageai import VoyageAIEmbedder

# Embed sentence in database
embeddings = VoyageAIEmbedder().get_embedding("The quick brown fox jumps over the lazy dog.")

# Print the embeddings and their dimensions
print(f"Embeddings: {embeddings[:5]}")
print(f"Dimensions: {len(embeddings)}")

# Use an embedder in a knowledge base
knowledge = Knowledge(
    vector_db=PgVector(
        db_url="postgresql+psycopg://ai:ai@localhost:5532/ai",
        table_name="voyageai_embeddings",
        embedder=VoyageAIEmbedder(),
    ),
    max_results=2,
)

Params

ParameterTypeDefaultDescription
modelstr"voyage-2"The name of the model used for generating embeddings.
dimensionsint1024The dimensionality of the embeddings generated by the model.
request_paramsOptional[Dict[str, Any]]-Additional parameters to include in the API request. Optional.
api_keystr-The API key used for authenticating requests.
base_urlstr"https://api.voyageai.com/v1/embeddings"The base URL for the API endpoint.
max_retriesOptional[int]-The maximum number of retries for API requests. Optional.
timeoutOptional[float]-The timeout duration for API requests. Optional.
client_paramsOptional[Dict[str, Any]]-Additional parameters for configuring the API client. Optional.
voyage_clientOptional[Client]-An instance of the Client to use for making API requests. Optional.
enable_batchboolFalseEnable batch processing to reduce API calls and avoid rate limits
batch_sizeint100Number of texts to process in each API call for batch operations.

Developer Resources