Rerank

POST

This endpoint takes in a query and a list of texts and produces an ordered array with each text assigned a relevance score.

Headers

X-Client-NamestringOptional

The name of the project that is making the request.

Request

This endpoint expects an object.
modelstringRequired

The identifier of the model to use, eg rerank-v3.5.

querystringRequired

The search query

documentslist of stringsRequired

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.

Note: long documents will automatically be truncated to the value of max_tokens_per_doc.

Note: structured data should be formatted as YAML strings for best performance.

top_nintegerOptional

Limits the number of returned rerank results to the specified value. If not passed, all the rerank results will be returned.

max_tokens_per_docintegerOptional

Defaults to 4096. Long documents will be automatically truncated to the specified number of tokens.

Response

This endpoint returns an object.
resultslist of objects

An ordered list of ranked documents

idstringOptional
metaobjectOptional