Orq MCP is live: Use natural language to interrogate traces, spot regressions, and experiment your way to optimal AI configurations. Available in Claude Desktop, Claude Code, Cursor, and more. Start now →
Rerank a list of documents based on their relevance to a query.
curl --request POST \
--url https://api.orq.ai/v2/router/rerank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"documents": [
"<string>"
],
"model": "<string>",
"top_n": 123,
"filename": "<string>",
"name": "<string>",
"fallbacks": [
{
"model": "<string>"
}
],
"retry": {
"count": 3,
"on_codes": [
429,
500,
502,
503,
504
]
},
"orq": {
"name": "<string>",
"fallbacks": [
{
"model": "openai/gpt-4o-mini"
}
],
"retry": {
"count": 3,
"on_codes": [
429,
500,
502,
503,
504
]
},
"load_balancer": {
"type": "weight_based",
"models": [
{
"model": "openai/gpt-4o",
"weight": 0.7
},
{
"model": "anthropic/claude-3-5-sonnet",
"weight": 0.3
}
]
}
}
}
'{
"object": "list",
"results": [
{
"object": "rerank",
"index": 123,
"relevance_score": 123,
"document": {
"text": "<string>"
}
}
],
"id": "<string>",
"usage": {
"total_tokens": 123
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
input
The search query
A list of texts that will be compared to the query. For optimal performance we recommend against sending more than 1,000 documents in a single request.
The identifier of the model to use
The number of most relevant documents or indices to return, defaults to the length of the documents
The filename of the document to rerank
The name to display on the trace. If not specified, the default system name will be used.
Array of fallback models to use if primary model fails
Show child attributes
Retry configuration for the request
Show child attributes
Cache configuration for the request.
Show child attributes
Load balancer configuration for the request.
Show child attributes
Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://api.orq.ai/v2/router/rerank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"documents": [
"<string>"
],
"model": "<string>",
"top_n": 123,
"filename": "<string>",
"name": "<string>",
"fallbacks": [
{
"model": "<string>"
}
],
"retry": {
"count": 3,
"on_codes": [
429,
500,
502,
503,
504
]
},
"orq": {
"name": "<string>",
"fallbacks": [
{
"model": "openai/gpt-4o-mini"
}
],
"retry": {
"count": 3,
"on_codes": [
429,
500,
502,
503,
504
]
},
"load_balancer": {
"type": "weight_based",
"models": [
{
"model": "openai/gpt-4o",
"weight": 0.7
},
{
"model": "anthropic/claude-3-5-sonnet",
"weight": 0.3
}
]
}
}
}
'{
"object": "list",
"results": [
{
"object": "rerank",
"index": 123,
"relevance_score": 123,
"document": {
"text": "<string>"
}
}
],
"id": "<string>",
"usage": {
"total_tokens": 123
}
}