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.
Authentication
AuthorizationBearer
Pass your EmpirioLabs API key as a bearer token. The Anthropic-style
x-api-key header is also accepted on every endpoint.
Request
This endpoint expects an object.
model
query
Query text. Max 4,000 tokens.
documents
Candidate documents to sort. Max 500 items, each up to 4,000 tokens.
top_n
Number of top-ranked documents to return. Defaults to all.
instruct
Custom English instruction guiding the sort. Defaults to a Q&A
retrieval policy. Pass "Retrieve semantically similar text." for
similarity sorting.
return_documents
When true, return the original document text alongside each result.
Response
Sorted relevance scores.
output
usage
request_id
