younifyd
Menu

Rerank results

Rerank results

POST/rerank

Use it in a workflow

  1. Add a step and choose the Pinecone connector.
  2. Pick the Rerank results action (under Inference).
  3. Fill in the fields below, then reference the result from later steps as {{rerankResults.response.data}}.

Request

Request body

Enter the body as JSON in the step's Body field.

modelstringrequired

The [model](https://docs.pinecone.io/guides/search/rerank-results#reranking-models) to use for reranking.

querystringrequired

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.

Default true

rank_fieldsarray<string>

The field(s) to consider for reranking. If not provided, the default is `["text"]`. The number of fields supported is [model-specific](https://docs.pinecone.io/guides/search/rerank-results#reranking-models).

Default ["text"]

documentsarray<object>required

The documents to rerank.

parametersobject

Additional model-specific parameters. Refer to the [model guide](https://docs.pinecone.io/guides/search/rerank-results#reranking-models) for available model parameters.

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

Response

Returns 200 with an object. Read it in later steps with {{rerankResults.response.data.<field>}}.

modelstring

The model used to rerank documents.

dataarray<object>

The reranked documents.

indexintegerrequired

The index position of the document from the original request.

scorenumberrequired

The relevance of the document to the query, normalized between 0 and 1, with scores closer to 1 indicating higher relevance.

documentobject

Document for reranking

usageobject

Usage statistics for the model inference.

rerank_unitsinteger (int32)

The number of rerank units consumed by this operation.

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

Need more? See the Pinecone guide for connection setup and behaviour shared by every action.

Was this page helpful?