Files
microsoft--promptflow/docs/reference/tools-reference/rerank-tool.md
T
wehub-resource-sync e768098d0e
Flake8 Lint / flake8 (push) Waiting to run
Spell check CI / Spell_Check (push) Waiting to run
tools_continuous_delivery / Private PyPI non-main branch release (push) Has been skipped
tools_continuous_delivery / Private PyPI main branch release (push) Failing after 2m42s
Publish Promptflow Doc / Build (push) Has been cancelled
Publish Promptflow Doc / Deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:39:52 +08:00

2.8 KiB
Raw Blame History

Rerank

Introduction

Rerank is a semantic search tool that improves search quality with a semantic-based reranking system which can contextualize the meaning of a user's query beyond keyword relevance. This tool works best with look up tool as a ranker after the initial retrieval. The list of current supported ranking method is as follows.

Name Description
BM25 BM25 is an open source ranking algorithm to measure the relevance of documents to a given query
Scaled Score Fusion Scaled Score Fusion calculates a scaled relevance score.
Cohere Rerank Cohere Rerank is the markets leading reranking model used for semantic search and retrieval-augmented generation (RAG).

Requirements

  • For AzureML users, the tool is installed in default image, you can use the tool without extra installation.

  • For local users,

    pip install promptflow-vectordb

Prerequisites

BM25 and Scaled Score Fusion are included as default reranking methods. To use cohere rerank model, you should create serverless deployment to the model, and establish connection between the tool and the resource as follows.

  • Add Serverless Model connection. Fill "API base" and "API key" field to your serverless deployment.

Inputs

Name Type Description Required
query string the question relevant to your input documents Yes
ranker_parameters string the type of ranking methods to use Yes
result_groups object the list of document chunks to rerank. Normally this is output from lookup Yes
top_k int the maximum number of relevant documents to return No

Outputs

Return Type Description
text text of the entity
metadata metadata like file path and url
additional_fields metadata and rerank score
Output
[
  {
      "text": "sample text",
      "metadata":
      {
          "filepath": "sample_file_path",
          "metadata_json_string": "meta_json_string"
          "title": "",
          "url": ""
      },
      "additional_fields":
      {
          "filepath": "sample_file_path",
          "metadata_json_string": "meta_json_string"
          "title": "",
          "url": "",
          "@promptflow_vectordb.reranker_score": 0.013795365
      }
  }
]