v1

latestOpenAPI 3.0.3Apache 2.02026-07-1372170520.1 KB
Inference

Rerank results

Rerank results according to their relevance to a query.

For guidance and examples, see Rerank results.

post/rerank

Headers

X-Pinecone-Api-Versionstring required

Required date-based version header

Request body

modelstring required

The model to use for reranking.

querystring required

The query to rerank documents against.

top_ninteger

The number of results to return sorted by relevance. Defaults to the number of inputs.

return_documentsboolean

Whether to return the documents in the response.

rank_fieldsstring[]

The field(s) to consider for reranking. If not provided, the default is ["text"].

The number of fields supported is model-specific.

documentsInferenceDocument[] required

The documents to rerank.

parametersobject

Additional model-specific parameters. Refer to the model guide for available model parameters.

Example request

{
  "model": "bge-reranker-v2-m3",
  "query": "What is the capital of France?",
  "top_n": 5,
  "return_documents": true,
  "documents": [
    {
      "id": "1",
      "text": "Paris is the capital of France.",
      "title": "France",
      "url": "https://example.com"
    }
  ],
  "parameters": {
    "truncate": "END"
  }
}

Response

OK

modelstring required

The model used to rerank documents.

Example response

{
  "model": "bge-reranker-v2-m3",
  "data": [
    {
      "score": 0.5,
      "document": {
        "id": "1",
        "text": "Paris is the capital of France.",
        "title": "France",
        "url": "https://example.com"
      }
    }
  ],
  "usage": {
    "rerank_units": 1
  }
}