Skip to content
Guides/Models and Routing

Reranking

Order a supplied set of candidate documents by relevance to a query.

Before You Begin

A reranker scores candidate documents against a query. It does not search your corpus or create a vector index. Retrieve candidates first using your search system, then rerank the selected text.

Complete the quickstart. You need an enabled reranking model, rerank.write, and available workspace credits. The current profile accepts up to eight short documents; each query and document is limited to 256 ASCII characters, excluding angle brackets.

Rank Your Candidates

Keep the original document order so the returned indexes can be mapped back to your records. Replace the example model with an enabled reranking model:

curl --fail --show-error --request POST \
  --url "$AUDIOLAB_API_URL/v1/rerank" \
  --header "Authorization: Bearer $AUDIOLAB_API_KEY" \
  --header 'Idempotency-Key: YOUR_UNIQUE_REQUEST_ID' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "VALUE",
  "query": "VALUE",
  "documents": [
    "VALUE"
  ]
}'

The response contains sorted results with an index and relevance_score. Use the index to retrieve the corresponding document. If you set top_n, it cannot exceed the number of supplied documents.

See the Reranking reference for the complete request and response contract.

Use and Retain the Ranking

Choose the highest-ranked candidates for your results page or model context. Relevance scores describe this ranking task; evaluate application thresholds against representative queries before using a score as a hard cutoff.

Retain the result when it arrives. Get Reranking Status reports processing and settlement, but does not retain query or document text for replay. Follow Errors and Debugging if the original result is uncertain.