Rerank documents

Sort candidate `documents` by semantic relevance to a `query`. Returns each document's original index plus a 0-1 relevance score (higher = more relevant). Score is relative to the request and not comparable across requests. Built for RAG and search refinement: feed in the top-N hits from your vector store / BM25 / hybrid retriever, and the model returns a tighter, better-ordered shortlist.

身份验证

AuthorizationBearer

Pass your EmpirioLabs API key as a bearer token. The Anthropic-style x-api-key header is also accepted on every endpoint.

请求

This endpoint expects an object.
modelstring必需
querystring必需
Query text. Max 4,000 tokens.
documentslist of strings必需
Candidate documents to sort. Max 500 items, each up to 4,000 tokens.
top_ninteger可选1-500

Number of top-ranked documents to return. Defaults to all.

instructstring可选

Custom English instruction guiding the sort. Defaults to a Q&A retrieval policy. Pass "Retrieve semantically similar text." for similarity sorting.

return_documentsboolean可选默认为 false
When true, return the original document text alongside each result.

响应

Sorted relevance scores.
outputobject
usageobject
request_idstring