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.

Authentifizierung

AuthorizationBearer

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

Anfrage

This endpoint expects an object.
modelstringErforderlich
querystringErforderlich
Query text. Max 4,000 tokens.
documentslist of stringsErforderlich
Candidate documents to sort. Max 500 items, each up to 4,000 tokens.
top_nintegerOptional1-500

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

instructstringOptional

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

return_documentsbooleanOptionalStandardwert ist false
When true, return the original document text alongside each result.

Antwort

Sorted relevance scores.
outputobject
usageobject
request_idstring