Inference API
Rerank
Rerank document search results for optimized retrieval accuracy in RAG workflows.
POST/v1/rerank
API Key (Bearer zrv_...)
Reorder candidate documents by their relevance to a query through a supported reranking model.
Code example
curl https://api.zorveus.com/v1/rerank \
-H "Content-Type: application/json" \
-H "Authorization: Bearer zrv_your_api_key" \
-d '{
"model": "cohere/rerank-v3.5",
"query": "What is write-ahead logging?",
"documents": [
"Write-ahead logging records transactions sequentially before disk writes.",
"Redis is an in-memory key-value data store.",
"PostgreSQL uses MVCC for concurrency control."
],
"top_n": 2
}'Request and result
Send query, documents, and a routable model. Use top_n to limit returned results when the provider supports it. Each result identifies the original document position and includes a relevance score or provider-equivalent ranking value.
Reranking does not retrieve documents. Retrieve a candidate set first, then rerank only the number of documents that fits the model's limits and your latency budget.
Check GET /v1/models before using the example model. Provider model IDs and response fields can differ.
Was this page helpful?
Edit this page on GitHub