Skip to main content

Overview

The VoyageAIEmbedder 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-2
  • voyage-large-2
  • voyage-code-2
  • voyage-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

  • 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.
Parameters:
  • input_data (str | list[str] | Iterable[int] | Iterable[Iterable[int]]): Input to embed
Returns: 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.
Parameters:
  • input_data_list (list[str]): List of texts to embed
Returns: list[list[float]] - List of embedding vectors

Input Handling

The Voyage embedder has special input handling:
Implementation:

Dimension Truncation

Voyage embeddings are truncated to embedding_dim:
Implementation:

Batch Processing

Voyage AI efficiently processes batches:
Implementation:

Error Handling

Common errors:
  • Authentication error: Invalid API key
  • Rate limit error: Too many requests
  • Input validation error: Invalid input format
  • Network error: Connection issues

Use with Graphiti

Performance Tips

  1. Use voyage-3 for general tasks: Best performance/speed balance
  2. Use voyage-code-2 for code: Optimized for code similarity
  3. Use voyage-lite for speed: Faster but lower quality
  4. Batch requests: Always use create_batch() for multiple inputs
  5. Set appropriate dimensions: Lower dims = faster search

Model Comparison

API Key Setup

Get your Voyage AI API key from https://www.voyageai.com: