Inference
Rerank documents
Rerank documents according to their relevance to a query.
For guidance and examples, see Rerank documents.
POST
/
rerank
Authorizations
Api-Key
string
headerrequiredAn API Key is required to call Pinecone APIs. Get yours from the console.
Body
application/json
model
string
requiredThe model to use for reranking.
query
string
requiredThe query to rerank documents against.
documents
object[]
requiredThe documents to rerank.
top_n
integer
The number of results to return sorted by relevance. Defaults to the number of inputs.
return_documents
boolean
default: trueWhether to return the documents in the response.
rank_fields
string[]
The fields to rank the documents by. If not provided, the default is "text"
.
parameters
object
Additional model-specific parameters for the reranker.
Response
200 - application/json
The result of a reranking request.
model
string
requiredThe model used to rerank documents.
data
object[]
requiredThe reranked documents.
usage
object
requiredUsage statistics for the model inference.
Was this page helpful?