Reranks a list of documents based on their relevance to a query. This endpoint provides a unified interface to reranking models from multiple providers including Cohere, Voyage, Jina, Pinecone, Bedrock, and Azure AI.
Reranking is useful for improving search results by scoring and sorting documents based on semantic relevance to a query, rather than just keyword matching.
An ID you can pass to refer to a span under a trace.
Link a child span to a parent span
Name for the Span ID
Pass any arbitrary metadata along with your request
Request body for reranking documents. The unified API supports multiple providers including Cohere, Voyage, Jina, Pinecone, Bedrock, and Azure AI.
ID of the model to use for reranking. Model availability depends on the provider:
rerank-v3.5, rerank-english-v3.0, rerank-multilingual-v3.0, rerank-english-v2.0, rerank-multilingual-v2.0rerank-2, rerank-2-litejina-reranker-v2-base-multilingual, jina-reranker-v1-base-en, jina-reranker-v1-turbo-en, jina-reranker-v1-tiny-enbge-reranker-v2-m3, pinecone-rerank-v0arn:aws:bedrock:us-west-2::foundation-model/cohere.rerank-v3-5:0)cohere. (the gateway strips that prefix for the upstream request)"rerank-v3.5"
The search query to compare against the documents.
"What is the capital of France?"
The list of documents to rerank. Each document can be a string or an object with a text field.
The documents will be scored based on their relevance to the query.
1A document to be reranked. Can be a simple string or an object with a text field and optional metadata.
"Paris is the capital of France."
[
"Paris is the capital of France.",
"Berlin is the capital of Germany.",
"Madrid is the capital of Spain."
]The number of top results to return. If not specified, all documents are returned sorted by relevance.
For Voyage, the gateway maps this field to the provider's top_k parameter.
x >= 13
Whether to return the document text in the response. Supported by Voyage, Jina, and Pinecone.
Maximum number of tokens per document. Documents exceeding this limit will be truncated. Cohere-specific parameter.
x >= 1Request priority hint. Cohere-specific parameter.
The fields to use for ranking when documents are objects with multiple fields. Pinecone-specific parameter.
["text", "title"]Whether to truncate documents that exceed the model's maximum context length. Voyage-specific parameter.
Additional provider-specific parameters. Pinecone-specific parameter.
OK
Response from the rerank endpoint.
The object type, which is always "list".
list "list"
The reranked results sorted by relevance score in descending order.
The model used for reranking.
"rerank-v3.5"
A unique identifier for the rerank request.
"rerank-abc123"
Usage information for the rerank request.
The provider that processed the request.
"cohere"