Overview
TheVoyageAIEmbedder provides embeddings using Voyage AI’s embedding models, including voyage-3 which offers state-of-the-art performance for retrieval tasks.
Installation
Basic Usage
Configuration
VoyageAIEmbedderConfig
str
default:"'voyage-3'"
Voyage AI model to use. Options:
voyage-3(default, latest model)voyage-2voyage-large-2voyage-code-2voyage-lite-02-instruct
int
default:"1024"
Output embedding dimensionality. Truncates native dimensions to this size.
str | None
default:"None"
Voyage AI API key. If not provided, uses
VOYAGE_API_KEY environment variable.Constructor
VoyageAIEmbedderConfig | None
default:"None"
Configuration object. If
None, creates default config with voyage-3 model.Supported Models
voyage-3 (Recommended)
- Native dimensions: 1024
- Context length: 32K tokens
- Best for: General purpose, state-of-the-art performance
voyage-2
- Native dimensions: 1024
- Context length: 16K tokens
- Best for: Backwards compatibility
voyage-large-2
- Native dimensions: 1536
- Context length: 16K tokens
- Best for: Maximum quality
voyage-code-2
- Native dimensions: 1536
- Context length: 16K tokens
- Best for: Code search and retrieval
voyage-lite-02-instruct
- Native dimensions: 1024
- Context length: 4K tokens
- Best for: Fast, lightweight tasks
Methods
create()
Generate a single embedding vector.input_data(str | list[str] | Iterable[int] | Iterable[Iterable[int]]): Input to embed
list[float] - Embedding vector
Special handling:
- Converts non-string inputs to string
- Filters out empty strings
- Returns empty list if no valid input
create_batch()
Generate embeddings for multiple texts.input_data_list(list[str]): List of texts to embed
list[list[float]] - List of embedding vectors
Input Handling
The Voyage embedder has special input handling:Dimension Truncation
Voyage embeddings are truncated toembedding_dim:
Batch Processing
Voyage AI efficiently processes batches:Error Handling
- Authentication error: Invalid API key
- Rate limit error: Too many requests
- Input validation error: Invalid input format
- Network error: Connection issues
Example: Semantic Search
Example: Code Search
Use with Graphiti
Performance Tips
- Use voyage-3 for general tasks: Best performance/speed balance
- Use voyage-code-2 for code: Optimized for code similarity
- Use voyage-lite for speed: Faster but lower quality
- Batch requests: Always use
create_batch()for multiple inputs - Set appropriate dimensions: Lower dims = faster search