Skip to content

Embedding providers

The embedding model turns chunks and queries into vectors. Pick one with EMBEDDING_PROVIDER (and usually EMBEDDING_MODEL), install its extra, then restart.

EMBEDDING_PROVIDER="FASTEMBED"
EMBEDDING_MODEL="BAAI/bge-small-en-v1.5"
uv sync --extra fastembed

GET /api/v1/embeddings/model shows the active provider, model and vector dimension.

Providers

EMBEDDING_PROVIDER Extra Default model Runs
SENTENCE_TRANSFORMERS sentence-transformers sentence-transformers/all-MiniLM-L6-v2 Locally, with PyTorch
FASTEMBED fastembed BAAI/bge-small-en-v1.5 Locally, with ONNX (no PyTorch)
OLLAMA ollama nomic-embed-text (pull it first) A local Ollama server (or Ollama Cloud with a key)
OPENAI openai text-embedding-3-small Hosted
AZURE_OPENAI openai your deployment name (required) Hosted. EMBEDDING_URL is the resource endpoint
COHERE cohere embed-v4.0 Hosted
VOYAGE voyage voyage-3.5 Hosted
GEMINI gemini gemini-embedding-001 Hosted, or Vertex AI with GOOGLE_CLOUD_PROJECT
MISTRAL mistral mistral-embed Hosted
JINA jina jina-embeddings-v3 Hosted
HUGGINGFACE huggingface sentence-transformers/all-MiniLM-L6-v2 Inference Providers, or a Text Embeddings Inference server at EMBEDDING_URL
BEDROCK bedrock amazon.titan-embed-text-v2:0 AWS, with AWS credentials and AWS_REGION
OPENROUTER openai openai/text-embedding-3-small Hosted
LOCALAI openai the server's model http://localhost:8080/v1
LMSTUDIO openai the server's model http://localhost:1234/v1
LEMONADE openai the server's model http://localhost:13305/v1
LITELLM openai a proxy model name http://localhost:4000/v1
OPENAI_COMPATIBLE openai the server's model Any /v1/embeddings server: vLLM, llama.cpp, Xinference, Together, Fireworks, DeepInfra, NVIDIA NIM, ... EMBEDDING_URL is required (it ends with /v1)

EMBEDDING_URL changes the default host and port of the local servers.

Vector size

The vector dimension comes from EMBEDDING_DIMENSIONS when set, else from the model, else from one probe request at startup.

EMBEDDING_DIMENSIONS asks for shorter vectors, for models that support it: OpenAI text-embedding-3-*, Cohere v4, Voyage, Gemini, Jina v3/v4, Titan v2 and Matryoshka models. Providers that can't shorten vectors refuse it at startup.

Query and document prefixes

Some models are trained with an instruction in front of queries and passages. Providers with a query/document option (Cohere, Voyage, Gemini, Jina, Bedrock-Cohere, and sentence-transformers models with prompts) handle it themselves. For the others, set the prefixes:

Model EMBEDDING_QUERY_PREFIX EMBEDDING_DOCUMENT_PREFIX
nomic-embed-text "search_query: " "search_document: "
E5 models "query: " "passage: "
bge-*-en-v1.5 "Represent this sentence for searching relevant passages: " ""

Other settings

Setting Default
EMBEDDING_API_KEY OpenAI, Azure OpenAI, OpenRouter, Cohere, Voyage, Gemini, Mistral, Jina, Hugging Face (HF token), Ollama Cloud. Optional for LiteLLM, Lemonade and other local servers
EMBEDDING_BATCH_SIZE the provider's Texts per request, capped by the provider's limit
EMBEDDING_NORMALIZE true L2-normalize vectors. Keep it true with VECTOR_DB_DISTANCE_METHOD="dot"
EMBEDDING_DEVICE auto sentence-transformers: cpu, cuda or mps
EMBEDDING_TRUST_REMOTE_CODE false sentence-transformers models with custom code

Changing the model

Each collection records the model and dimension that created it. Inserts and searches with another model are rejected, so you never get silently wrong results. After changing the model:

  1. GET /api/v1/projects/{id}/index shows which projects no longer match.
  2. POST /api/v1/projects/{id}/reindex recreates the collection for the new model and re-embeds the documents. Their stored text is reused, so no file is extracted again.

See Reindexing.

Choosing a model

  • Getting started, CPU only: FASTEMBED with BAAI/bge-small-en-v1.5 is small and fast, and needs no PyTorch.
  • Better local quality: SENTENCE_TRANSFORMERS with a larger model such as BAAI/bge-m3 (multilingual), on a GPU if you have one.
  • No local compute: a hosted provider. text-embedding-3-small, embed-v4.0 and voyage-3.5 are common choices.
  • Many languages: pick a multilingual model, and set the project's text_search_language for keyword search.

Measure candidates with Evaluation on your own documents. Each model needs its own project, or a reindex.