Repository navigation
Conversation
… rerank providers
Register Voyage AI as a built-in provider for embedding and rerank models.
- Text embeddings (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) on POST /embeddings, with input_type
(document/query) and output_dimension for the Matryoshka models. The
fixed-width models send no output_dimension.
- Contextualized embeddings (voyage-context-4, voyage-context-3) on
POST /contextualizedembeddings. Documents go as a flat list with
enable_auto_chunking and chunk_size 32000; every text must come back as
exactly one chunk. Queries go as one-element lists without auto-chunking.
- Multimodal embeddings (voyage-multimodal-3.5, voyage-multimodal-3) on
POST /multimodalembeddings, with text and base64 image inputs, so they work
with image vector indexing.
- Rerank (rerank-3, rerank-3-lite, rerank-2.5, rerank-2.5-lite) on POST /rerank,
with optional top_k and return_documents.
- Voyage's {"detail": "..."} error body is surfaced as the error message.
- Catalog entries carry dimensions, context windows and per-million-token
prices. The model is never defaulted; the rerank factory now refuses an empty
model name, as the embedding factory already did.
- There is no official Go SDK, so the protocols are REST clients over the
shared endpoint, retry and placement helpers. Requests are split only at the
documented 1000 inputs; tokens are not estimated.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spring AI has no integration for Voyage AI, whose embedding and rerank models are widely used for retrieval.
This adds one: text embeddings, contextualized chunk embeddings, multimodal embeddings and reranking, with auto-configuration, a starter and reference documentation.
Voyage AI has no official Java SDK, so
VoyageAiApiis aRestClientbased client in the style of the Mistral AI module.Every request type checks the constraints that Voyage AI documents for it (known model, supported output dimensions, at most 1000 inputs, auto-chunking rules, URL or base64 media) before anything is sent, and the
{"detail": ...}body of an error response becomes the exception message.What is added:
VoyageAiEmbeddingModel, anEmbeddingModelforvoyage-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-2andvoyage-law-2. A request of more than 1000 texts is split into several calls and the vectors keep the order of the texts.VoyageAiContextualizedEmbeddingModelforvoyage-context-4andvoyage-context-3. Documents are sent as one string each withenable_auto_chunkingand achunk_sizeof 32000, queries without chunking. The chunk text that Voyage AI returns is available as thedocumentDataof each embedding. It is not anEmbeddingModel, because one document yields several vectors.VoyageAiMultimodalEmbeddingModel, aDocumentEmbeddingModel(like the Vertex AI one) forvoyage-multimodal-3.5andvoyage-multimodal-3. Images are given as URLs, base64 or file bytes,voyage-multimodal-3.5also takesvideo/mp4.VoyageAiMultimodalInputcombines text and media in one input, which aDocumentcannot express.VoyageAiDocumentReranker, a RAGDocumentPostProcessorforrerank-3,rerank-3-lite,rerank-2.5andrerank-2.5-lite, withtopK. It is independent ofDecisionDocumentReranker.spring-ai-autoconfigure-model-voyage-aiandspring-ai-starter-model-voyage-ai, plus the BOM entries and a reference page.Two decisions worth a look:
spring.ai.voyageai.embedding.model. The other models are created when theirmodelproperty is set.usage.total_tokensfails instead of reporting zero tokens.Voyage AI also limits the tokens of a request (1M, 320K or 120K depending on the model). There is no Java tokenizer for the Voyage AI models, so the client does not count tokens and the API rejects an over-sized request. The reference documentation says so.
Tested with unit tests against a mock server, an auto-configuration test, integration tests (
VoyageAiIT, run whenVOYAGE_API_KEYis set) and a run of a Spring Boot application through the starter against the live API: every model, dimensions 256 to 2048, query and document input types, batching over 1000 inputs, images by URL, base64 and file, a video, and the invalid cases.