curl --request POST \
--url https://api.orq.ai/v2/gateway/rerank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"documents": [
"<string>"
],
"model": "<string>",
"top_n": 123,
"filename": "<string>",
"orq": {
"name": "<string>",
"fallbacks": [
{
"model": "openai/gpt-4o-mini"
}
],
"cache": {
"type": "exact_match",
"ttl": 3600
},
"retry": {
"count": 3,
"on_codes": [
429,
500,
502,
503,
504
]
},
"contact": {
"id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"display_name": "Jane Doe",
"email": "[email protected]",
"metadata": [
{
"department": "Engineering",
"role": "Senior Developer"
}
],
"logo_url": "https://example.com/avatars/jane-doe.jpg",
"tags": [
"hr",
"engineering"
]
},
"load_balancer": [
{
"model": "openai/gpt-4o",
"weight": 0.7
},
{
"model": "anthropic/claude-3-5-sonnet",
"weight": 0.3
}
],
"timeout": {
"call_timeout": 30000
}
}
}
'{
"object": "list",
"results": [
{
"object": "rerank",
"index": 123,
"relevance_score": 123,
"document": {
"text": "<string>"
}
}
],
"id": "<string>",
"usage": {
"total_tokens": 123
}
}Rerank a list of documents based on their relevance to a query.
curl --request POST \
--url https://api.orq.ai/v2/gateway/rerank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"documents": [
"<string>"
],
"model": "<string>",
"top_n": 123,
"filename": "<string>",
"orq": {
"name": "<string>",
"fallbacks": [
{
"model": "openai/gpt-4o-mini"
}
],
"cache": {
"type": "exact_match",
"ttl": 3600
},
"retry": {
"count": 3,
"on_codes": [
429,
500,
502,
503,
504
]
},
"contact": {
"id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"display_name": "Jane Doe",
"email": "[email protected]",
"metadata": [
{
"department": "Engineering",
"role": "Senior Developer"
}
],
"logo_url": "https://example.com/avatars/jane-doe.jpg",
"tags": [
"hr",
"engineering"
]
},
"load_balancer": [
{
"model": "openai/gpt-4o",
"weight": 0.7
},
{
"model": "anthropic/claude-3-5-sonnet",
"weight": 0.3
}
],
"timeout": {
"call_timeout": 30000
}
}
}
'{
"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
Show child attributes
The name to display on the trace. If not specified, the default system name will be used.
Retry configuration for the request
Information about the contact making the request. If the contact does not exist, it will be created automatically.
Show child attributes
Unique identifier for the contact
"contact_01ARZ3NDEKTSV4RRFFQ69G5FAV"
Display name of the contact
"Jane Doe"
Email address of the contact
URL to the contact's avatar or logo
"https://example.com/avatars/jane-doe.jpg"
A list of tags associated with the contact
["hr", "engineering"]
Array of models with weights for load balancing requests
[
{ "model": "openai/gpt-4o", "weight": 0.7 },
{
"model": "anthropic/claude-3-5-sonnet",
"weight": 0.3
}
]
Returns the reranked documents.
list An ordered list of ranked documents
Show child attributes
The object type, which is always rerank.
rerank Corresponds to the index in the original list of documents to which the ranked document belongs.
Relevance scores are normalized to be in the range [0, 1]. Scores close to 1 indicate a high relevance to the query, and scores closer to 0 indicate low relevance.
A unique identifier for the rerank.
Was this page helpful?