Parameters
The identifier of the text embedding model to use.Available models:
voyage-3.5- Latest generation modelvoyage-3.5-lite- Lightweight version of 3.5voyage-3-large- Large capacity modelvoyage-3- Standard third generation modelvoyage-3-lite- Lightweight third generation modelvoyage-code-3- Optimized for code embeddingsvoyage-finance-2- Specialized for financial textvoyage-multilingual-2- Supports multiple languagesvoyage-law-2- Specialized for legal textvoyage-code-2- Previous generation code model
Returns
A text embedding model instance that implements the AI SDK’s
EmbeddingModelV3 interface.The model identifier passed during creation
The provider identifier:
"voyage.embedding"Maximum number of inputs per API call:
128Whether parallel calls are supported:
falseInput types
The text embedding model acceptsTextEmbeddingInput which can be:
- Single text:
string- A single text string - Multiple texts:
string[]- Array of texts combined into one embedding - Object format:
{ text: string | string[] }- Alternative format with explicit text property
Usage examples
Generate single embedding
Embed a single text string to generate one embedding vector.Generate multiple embeddings
Embed multiple text strings to generate separate embedding vectors.Combine multiple texts into one embedding
You can combine multiple text strings into a single embedding by passing an array. This is useful for embedding documents with multiple fields.Use provider options
You can customize the embedding behavior using provider-specific options.Provider options
You can pass Voyage-specific options through theproviderOptions parameter:
The input type for the embeddings. Defaults to
"query".query: Prepends “Represent the query for retrieving supporting documents: ”document: Prepends “Represent the document for retrieval: ”
The number of dimensions for the resulting output embeddings.If not specified, uses the model’s default dimension.Supported values vary by model:
voyage-code-3: 2048, 1024 (default), 512, 256voyage-3-large: 2048, 1024 (default), 512, 256
The data type for the resulting output embeddings. Defaults to
'float'.float: 32-bit single-precision floating-point numbers (supported by all models)int8: 8-bit integers from -128 to 127 (supported byvoyage-code-3)uint8: 8-bit integers from 0 to 255 (supported byvoyage-code-3)binary: Bit-packed quantized values using offset binary method (supported byvoyage-code-3)ubinary: Bit-packed quantized values (supported byvoyage-code-3)
Whether to truncate the input texts to fit within the context length.