rerankSearchResults
Takes a list of vector search results and a query, then reorders them by relevance using either a dedicated reranker model (RunPod or Replicate) or an LLM-based scoring fallback. Returns the top-K results with both original similarity scores and new rerank scores.
Execution path:
- If
use_dedicated_rerankeristrueandprovideris not"llm", calls a dedicated reranker (RunPod / Replicate). Falls through to the LLM path on failure. - Otherwise, computes relevance scores via
qwen3-235b-a22b-instruct-2507on Scaleway AI. - If the LLM response cannot be parsed, the original similarity scores are used as-is.
An empty search_results input returns immediately with count: 0.
Parameters
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
search_results | SearchResult[] | Yes | — | List of results to rerank. Each item must have page_content, metadata, and score |
query | string | Yes | — | Original search query. Minimum length: 1 |
top_k | integer | No | 5 | Number of top results to return after reranking |
rerank_model | string | No | "BAAI/bge-reranker-large" | Model to use when using a dedicated reranker |
provider | string? | No | null | Force a specific provider: runpod, replicate, or llm. Auto-detected from model when null |
use_dedicated_reranker | boolean | No | true | When true, attempts dedicated reranker before falling back to LLM scoring |
Output
| Field | Type | Description |
|---|---|---|
ranked_results | RankedResult[] | Reranked results, ordered by rerank_score descending, truncated to top_k |
count | integer | Number of results returned |
provider | string | Provider used: runpod, replicate, llm, none (empty input), or error |
model | string | Model used for reranking |
Each RankedResult:
| Field | Type | Description |
|---|---|---|
page_content | string | Text content of the chunk |
metadata | object | Document metadata |
similarity_score | float | Original similarity score from the vector search |
rerank_score | float | Score assigned by the reranker |
final_rank | integer | 1-based position in the final ordered list |
Example
{
"id": "rerank",
"type": "rerankSearchResults",
"data": {
"label": "Rerank Results",
"isExecuted": false,
"handles": ["inputs", "outputs"],
"schema": {},
"params": {
"search_results": { "value": "{{ @vectorSearch.documents }}", "isExpression": true, "isAttachedToInputNode": false },
"query": { "value": "{{ $input.query }}", "isExpression": true, "isAttachedToInputNode": false },
"top_k": { "value": 5, "isExpression": false, "isAttachedToInputNode": false },
"use_dedicated_reranker": { "value": true, "isExpression": false, "isAttachedToInputNode": false }
},
"inputs": [], "outputs": [], "errors": []
},
"position": { "x": 300, "y": 0 },
"isSelected": false,
"isDragging": false
}