Skip to content

feat: add Voyage AI embeddings provider - #345

Open
fzowl wants to merge 2 commits into
LibreChat-AI:mainfrom
fzowl:feat/voyage-ai-integration
Open

fzowl wants to merge 2 commits into
LibreChat-AI:mainfrom
fzowl:feat/voyage-ai-integration

Conversation

@fzowl

@fzowl fzowl commented Nov 14, 2026

Copy link
Copy Markdown

Summary

The RAG API can embed with OpenAI, Azure, Hugging Face, Ollama, Bedrock and Google, but not with Voyage AI. This adds EMBEDDINGS_PROVIDER=voyage, built on langchain-voyageai (which calls the official voyageai SDK), the same way the other providers wrap their LangChain integrations.

  • Text models: voyage-4-large, voyage-4, voyage-4-lite, voyage-code-4, voyage-3-large, voyage-3.5, voyage-3.5-lite, voyage-code-3, voyage-finance-2, voyage-law-2.
  • Contextualized models: voyage-context-4, voyage-context-3, run with auto-chunking (chunk_size=32000) in document mode and without chunking for queries.
  • There is no default model: EMBEDDINGS_MODEL must name one of the models above, otherwise the app stops at startup.
  • EMBEDDINGS_DIMENSIONS is checked per model (256/512/1024/2048, or only 1024 for voyage-finance-2 and voyage-law-2).
  • Truncation is off for the text models, so over-long input is an error rather than a clipped vector.
  • If auto-chunking returns a different number of vectors than texts, the request fails instead of storing misaligned vectors.
  • The key comes from VOYAGE_API_KEY (or RAG_VOYAGE_API_KEY, which takes precedence, like the other RAG_* keys).

Rerank and multimodal embeddings are not part of this change: the project has neither.

Testing

  • pytest: 333 passed; pytest -m integration: 35 passed.
  • Failure-mode tests cover a missing, unknown or other provider's model, invalid dimensions, a missing key and a vector/text count mismatch.
  • Ran the real app against a throwaway pgvector database (file upload with batched embedding, then /query) for every model with its native dimension, 256 and 2048 (1024 for voyage-finance-2/voyage-law-2), and checked the stored vector sizes.

Adds EMBEDDINGS_PROVIDER=voyage on top of langchain-voyageai (official
voyageai SDK). Supports the voyage-4, voyage-3.x, code, finance, law and
voyage-context models. EMBEDDINGS_MODEL is required (no default) and
validated, EMBEDDINGS_DIMENSIONS is checked per model, truncation is off,
and a vector/text count mismatch from auto-chunking is rejected.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant