AGTCloud API Docs
GuidesAPI ReferenceIntegrations and resourcesUpdate and help

Rerank

Rerank candidate documents by relevance to a query.

Overview

Rerank receives a query and a set of candidate documents and returns them in relevance order. It commonly follows vector, keyword, or hybrid retrieval to select the most relevant items from a limited candidate set.

API access

Base URL

https://api.agtcloud.cn/v1

Rerank documents

The following examples use the Jina-style POST /v1/rerank request.

curl 'https://api.agtcloud.cn/v1/rerank' \
  -H 'Authorization: Bearer your-api-key' \
  -H 'Content-Type: application/json' \
  --data '{
    "model": "MODEL_ID",
    "query": "How should I store an API key?",
    "documents": [
      "Store API keys in server-side environment variables or a secret manager.",
      "The model marketplace lists available models.",
      "Never expose a real API key in browser code or a public repository."
    ],
    "top_n": 2
  }'
ParameterRequiredDescription
modelNoRerank model ID; whether it can be omitted depends on the selected format
queryYesQuery used to judge relevance
documentsYesCandidate documents to reorder
top_nNoNumber of results to return

Read the result

Results are ordered by relevance. Use results[].index to map an item back to the source documents, and read its relevance score from results[].relevance_score.

Choose a request format

FormatRequest pathAPI Reference
JinaPOST /v1/rerankJina Rerank
CoherePOST /v1/rerankCohere Rerank
XinferencePOST /v1/rerankXinference Rerank

Understand relevance scores

  • A relevance score is not a probability.
  • Scores are primarily useful for comparing candidates within the same request.
  • Evaluate score thresholds and top_n with your own application data.

Learn more

On this page