๐Ÿ‡ฌ๐Ÿ‡ง EN
๐Ÿ‡ฎ๐Ÿ‡น IT

๐Ÿ“Š Reranker

Takes a list of search results and a query, then re-ranks them using a cross-encoder model for improved precision. Use after a RAG Query or Web Search node to surface the most relevant results at the top.

Category: Data Retrieval & Processing  ยท  Type identifier: reranker

Overview

Standard vector search and keyword search rank results by similarity scores that are computed independently for each document, without considering the relationship between the query and each result holistically. A cross-encoder reranker solves this by evaluating the query and each candidate result together, producing a more accurate relevance score.

The Reranker node accepts the output of any node that produces an array of results โ€” such as a RAG Query or Web Search node โ€” and returns the same results re-ordered by relevance score. You can optionally limit the output to the top N results, which is useful for controlling how much context you pass to a downstream Agent node.

The recommended pattern is: RAG Query โ†’ Reranker โ†’ Agent. The RAG Query retrieves a broad set of candidate chunks; the Reranker promotes the most relevant ones; the Agent receives a tighter, higher-quality context window.

Configuration

FieldStatusDescription
Results Required Reference to a prior step's array of results, e.g. {{ rag_step.output.results }}. Each item must have a content or text field.
Query Required The search query used to rank results. Usually the same query passed to the preceding search step.
Provider Required The AI provider to use for reranking. Must support reranking models (e.g. Cohere, OpenAI).
Model Required The cross-encoder model identifier, e.g. rerank-english-v3.0.
Top K Optional Return only the top N results after reranking. Default: 5. Leave blank to return all items.

Output Data

The node returns the input results re-ordered by relevance, with a score field added to each item.

FieldTypeDescription
resultsarrayRe-ranked array of result objects, each with the original fields plus a score property
results[*].scorenumberRelevance score (0โ€“1, higher is more relevant)
results[*].contentstringThe result text
countnumberNumber of results returned
{{ reranker_step.output.results }} {{ reranker_step.output.results[0].score }} {{ reranker_step.output.results[0].content }} {{ reranker_step.output.count }}

Example Usage

RAG โ†’ Reranker โ†’ Agent, ensuring the agent sees the most relevant chunks first.

  1. Add a RAG Query node. Set Top K to 20 to retrieve a broad candidate set. Use the step key rag_query.
  2. Add a Reranker node. Set Results to {{ rag_query.output.results }}, Query to the same query variable, Provider to Cohere, Model to rerank-english-v3.0, and Top K to 5.
  3. Add an Agent node. Pass {{ reranker_step.output.results }} as the context. The agent now receives only the 5 most relevant chunks.

Tips & Notes

Related Nodes