voyage.reranking(modelId)
Create a Voyage AI reranking model instance. This method is an alias for rerankingModel().
The model ID to use for reranking. Available models:
rerank-2.5rerank-2.5-litererank-2rerank-lite-2rerank-1rerank-lite-1
A reranking model instance that can be used with the
rerank() function from the Vercel AI SDK.Example
Provider options
You can pass Voyage-specific reranking options using theproviderOptions parameter:
Whether to return the documents in the response.If
false, the API returns a list of {"index", "relevanceScore"} where index refers to the index of a document within the input list.If true, the API returns a list of {"index", "document", "relevanceScore"} where document is the corresponding document from the input list.Whether to truncate the input to satisfy the context length limit on the query and the documents.If
true, the query and documents are truncated to fit within the context length limit before being processed by the reranker model.If false, an error is raised when the query exceeds:- 8,000 tokens for
rerank-2.5andrerank-2.5-lite - 4,000 tokens for
rerank-2 - 2,000 tokens for
rerank-2-liteandrerank-1 - 1,000 tokens for
rerank-lite-1
- 32,000 for
rerank-2.5andrerank-2.5-lite - 16,000 for
rerank-2 - 8,000 for
rerank-2-liteandrerank-1 - 4,000 for
rerank-lite-1
voyage.rerankingModel(modelId)
Alias for reranking(). Creates a Voyage AI reranking model instance.
The model ID to use for reranking. See
reranking() for available models.A reranking model instance that can be used with the
rerank() function from the Vercel AI SDK.