POST
/
v2
/
rerank
Rerank Documents
curl --request POST \
  --url https://{controlPlaneURL}/api/llm/v2/rerank \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "<string>",
  "query": "<string>",
  "documents": [
    "<string>"
  ],
  "top_n": 123,
  "max_tokens_per_doc": 123
}'
{
  "id": "<string>",
  "results": [
    {
      "index": 123,
      "relevance_score": 123
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-tfy-metadata
string

Optional metadata for the request

Body

application/json

Parameters for reranking documents.

model
string
required

Model to generate the response

query
string | null

The query string for reranking.

documents
string[] | null

An array of documents to rerank.

top_n
number | null

The number of top documents to return.

max_tokens_per_doc
number | null

The maximum number of tokens per document.

Response

Documents reranked successfully.

id
string
required

Id of the rerank response.

results
object[]
required

Array of results returned by the model.