Voyage Embeddings
The Voyage embeddings provider converts text into vectors using Voyage AI’s embedding models. Voyage offers state-of-the-art embeddings with specialized models for code, finance, and legal domains.
Installation
Section titled “Installation”npm install @youcraft/recall-embeddings-voyageimport { createMemory } from '@youcraft/recall'import { voyageEmbeddings } from '@youcraft/recall-embeddings-voyage'
const embeddings = voyageEmbeddings({ apiKey: process.env.VOYAGE_API_KEY!,})
const memory = createMemory({ db, embeddings, extractor })Configuration
Section titled “Configuration”| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Your Voyage API key |
model | string | "voyage-3-lite" | Embedding model to use |
inputType | string | "document" | Input type for embeddings |
Models
Section titled “Models”| Model | Dimensions | Description |
|---|---|---|
voyage-3-large | 1024 | Highest quality general-purpose embeddings |
voyage-3 | 1024 | High quality general-purpose embeddings |
voyage-3-lite | 512 | Fast, efficient general-purpose embeddings |
voyage-code-3 | 1024 | Optimized for code retrieval |
voyage-finance-2 | 1024 | Optimized for finance domain |
voyage-law-2 | 1024 | Optimized for legal domain |
voyage-multilingual-2 | 1024 | Multilingual support |
Examples
Section titled “Examples”High quality embeddings
Section titled “High quality embeddings”const embeddings = voyageEmbeddings({ apiKey: process.env.VOYAGE_API_KEY!, model: 'voyage-3-large',})Code retrieval
Section titled “Code retrieval”const embeddings = voyageEmbeddings({ apiKey: process.env.VOYAGE_API_KEY!, model: 'voyage-code-3',})Domain-specific models
Section titled “Domain-specific models”// For finance applicationsconst embeddings = voyageEmbeddings({ apiKey: process.env.VOYAGE_API_KEY!, model: 'voyage-finance-2',})
// For legal applicationsconst embeddings = voyageEmbeddings({ apiKey: process.env.VOYAGE_API_KEY!, model: 'voyage-law-2',})Input Types
Section titled “Input Types”Voyage models support different input types optimized for specific use cases:
| Type | Use Case |
|---|---|
document | Embedding documents to be searched (default) |
query | Embedding search queries |
For memory storage and retrieval, document is typically the best choice.
Batch Processing
Section titled “Batch Processing”The provider automatically handles Voyage’s batch size limit (128 texts per request):
// Handled automatically - splits into batches of 128await embeddings.embedBatch(texts) // Works with any size array