Ollama Reranker
AI-generatedSummary
Rerank documents by relevance to a search query using specified Ollama reranker models or compatible custom APIs, including support for the Custom Rerank API, VL Classifier API for document complexity classification, and Ollama Generate API (experimental). Returns the top-ranked documents filtered by a configurable score threshold.
Inputs
- Model (required) — Select the reranker model to use, loaded from your configured Ollama or custom API.
- API Type (required) — Choose the API endpoint for reranking. Options include the Custom Rerank API for true cross-encoder scoring (recommended), the VL Classifier API for document complexity classification with VL models, or the experimental Ollama Generate API which uses prompt-based heuristic scoring.
- Top K (required) — Maximum number of top-ranked documents to return, between 1 and 100.
- Score Threshold (required) — Minimum relevance score (0-1). Scores are auto-normalized across all supported models. Use 0.0 for no filtering.
- Task Instruction (required) — Custom instruction describing the reranking task to improve accuracy for specific cases.
- Additional Options — Options including whether to include original document scores, request timeout in milliseconds, batch size for concurrent processing, and advanced classification options for Vision-Language classification (conditionally shown).
Output shape
a list of documents reordered by relevance, each augmented with _rerankScore and _originalIndex fields (and optionally _originalScore).
Documents are filtered using the configured score threshold and limited to the top K results. The reranked output is compatible with Vector Store nodes expecting AiReranker type input.
Examples
Example 1: Using Ollama Reranker to reorder a set of documents for a given query.
Select a reranker model from your Ollama server, set API Type to 'Ollama Generate API', define 'Top K' and 'Score Threshold', optionally customize the instruction and additional options. When run, the node reranks input documents for relevance to the query and outputs the highest-ranked documents with scores.