Rerank

Rerank a list of documents based on their relevance to a query.

post/v2/router/rerank

Request

  • Base URL
    https://my.orq.ai
  • URL
    https://my.orq.ai/v2/router/rerank
  • Auth
    HTTP bearer

Request body

querystring required

The search query

documentsstring[] required

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.

modelstring required

The identifier of the model to use

top_ninteger

The number of most relevant documents or indices to return, defaults to the length of the documents

return_documentsboolean

Whether to return the documents in the response

filenamestring nullable

The filename of the document to rerank

namestring

The name to display on the trace. If not specified, the default system name will be used.

fallback_on_codesinteger[]

HTTP status codes that trigger fallback. Enter up to 20 unique integers from 400 to 599. When omitted or empty, defaults to [408, 429, 500, 502, 503, 504, 529].

Example request

{
  "model": "cohere/rerank-v4.0-pro",
  "retry": {
    "count": 3,
    "on_codes": [
      429,
      500,
      502,
      503,
      504
    ]
  },
  "cache": {
    "ttl": 3600
  },
  "load_balancer": {
    "models": [
      {
        "model": "openai/gpt-5.6-sol",
        "weight": 0.7
      }
    ]
  },
  "timeout": {
    "call_timeout": 30000
  },
  "orq": {
    "fallbacks": [
      {
        "model": "openai/gpt-5.4-mini"
      }
    ],
    "cache": {
      "ttl": 3600
    },
    "retry": {
      "count": 3,
      "on_codes": [
        429,
        500,
        502,
        503,
        504
      ]
    },
    "identity": {
      "id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
      "display_name": "Jane Doe",
      "email": "jane.doe@example.com",
      "metadata": [
        {
          "department": "Engineering",
          "role": "Senior Developer"
        }
      ],
      "logo_url": "https://example.com/avatars/jane-doe.jpg",
      "tags": [
        "hr",
        "engineering"
      ]
    },
    "contact": {
      "id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
      "display_name": "Jane Doe",
      "email": "jane.doe@example.com",
      "metadata": [
        {
          "department": "Engineering",
          "role": "Senior Developer"
        }
      ],
      "logo_url": "https://example.com/avatars/jane-doe.jpg",
      "tags": [
        "hr",
        "engineering"
      ]
    },
    "load_balancer": {
      "type": "weight_based",
      "models": [
        {
          "model": "openai/gpt-4o",
          "weight": 0.7
        },
        {
          "model": "anthropic/claude-3-5-sonnet",
          "weight": 0.3
        }
      ]
    },
    "timeout": {
      "call_timeout": 30000
    }
  }
}

Response

Returns the reranked documents.

idstring

A unique identifier for the rerank.

object'list' required

Changes

    • info

      added the new optional request property

    • info

      added the new optional request property /

    • info

      the request property default value changed from 1800 to 3600

    • info

      the request property default value changed from 1800 to 3600

    • info

      added the non-success response with the status

    • warning

      removed the request property

    • warning

      removed the request property /

    • info

      the request property default value changed from 3600 to 1800

    • info

      the request property default value changed from 3600 to 1800

    • info

      removed the non-success response with the status