Embeddings

Configure embedding models for retrieval and vector search.

Embedding models convert text into vectors. In Anvia, they are separate from completion models so retrieval code can swap providers without changing agent logic.

import { OpenAIClient } from "@anvia/openai";

const openai = new OpenAIClient({ apiKey });
const embeddings = openai.embeddingModel("text-embedding-3-small");

const result = await embeddings.embedTexts(["Anvia carries structured context."]);

Provider Support

Provider packageEmbedding support
@anvia/openaiOpenAI and OpenAI-compatible embedding endpoints
@anvia/geminiGemini embedding models
@anvia/mistralMistral embedding models
@anvia/fastembedLocal FastEmbed embeddings
@anvia/transformersLocal Transformers embeddings

Use embeddings with Vector Stores for retrieval workflows.

Keep the embedding model used for indexing and searching consistent. If one workflow embeds documents with one provider and searches with another, vector dimensions and similarity behavior may not match.