Voyage AI
Voyage AI provides embedding models for semantic search and related tasks. seekdb provides VoyageAIEmbeddingFunction so you can generate Voyage AI embeddings and use them with seekdb collections for RAG, agent memory, and other applications.
Using Voyage AI service requires you to follow Voyage AI's pricing rules and may incur corresponding fees. Before proceeding, please visit their official website or refer to relevant documentation to confirm and accept their pricing standards. If you do not agree, please do not proceed.
Dependencies and authentication
- Install the
@seekdb/voyageaipackage. - You need a valid Voyage AI API key for authentication.
Example: create a Voyage AI embedding function
Call the VoyageAIEmbeddingFunction constructor with a config object. The voyage-4-large model supports long context and high-accuracy retrieval. The API key is typically read from the environment (default: VOYAGE_API_KEY).
import { VoyageAIEmbeddingFunction } from "@seekdb/voyageai";
const ef = new VoyageAIEmbeddingFunction({
modelName: "voyage-4-large",
// inputType: "document",
// truncation: true,
});
Configurations:
- modelName: Voyage AI model name (default:
voyage-4-large). - apiKey: API key (optional; if omitted, read from the environment).
- apiKeyEnvVar: Environment variable name for the API key (default:
VOYAGE_API_KEY). - inputType: Hint for retrieval: use
"document"for documents being indexed and"query"for query texts. - truncation: Optional. When input exceeds the model's context window (for example, 32K tokens for voyage-4-large), whether to truncate the excess.