Package Information
Documentation
n8n-nodes-ollama-reranker
Advanced Reranker Provider for n8n - Supporting Ollama-compatible APIs, Custom Rerank servers, and VL Classifiers.
โ ๏ธ Important Note: Sorry folks, Ollama doesn't natively support reranker models! We're developing our own solution to bring powerful reranking capabilities to n8n. This package works with Ollama-compatible APIs that implement reranking through prompt-based scoring, custom rerank endpoints, and now Vision-Language classification servers.
Features
- ๐ฏ Integrates seamlessly with n8n Vector Store nodes
- ๐ Multiple API types: Ollama Generate, Custom Rerank, VL Classifier
- ๐ค Auto-detection of server capabilities
- ๐ง Multiple models supported (BGE Reranker, Qwen3 family)
- ๐จ VL Classification for document complexity analysis (v1.4.0+)
- โก Concurrent processing with configurable batch sizes
- ๐ Automatic retries with exponential backoff
- ๐ Flexible scoring with threshold and topK parameters
Installation
Via npm (Recommended)
npm install n8n-nodes-ollama-reranker
Via n8n Community Nodes UI
- Go to Settings โ Community Nodes
- Select Install
- Enter
n8n-nodes-ollama-reranker - Click Install
From Docker
Add to your n8n Dockerfile:
FROM n8nio/n8n:latest
USER root
RUN cd /usr/local/lib/node_modules/n8n && \
npm install n8n-nodes-ollama-reranker
USER node
Prerequisites
Choose your server type:
Option 1: Ollama (Prompt-based reranking)
- Ollama must be running and accessible
- Pull a reranker model:
# Recommended - BGE Reranker v2-M3
ollama pull bge-reranker-v2-m3
# Or Qwen3 models
ollama pull dengcao/Qwen3-Reranker-4B:Q5_K_M
Option 2: Custom Rerank API
Use any service implementing /api/rerank endpoint (like deposium-embeddings-turbov2)
Option 3: VL Classifier Server (NEW in v1.4.0)
Deploy a Vision-Language classifier server with:
/api/status- Server health and capabilities/api/classify- Document complexity classification- Optional
/api/rerank- Direct reranking support
Example: deposium_embeddings-turbov2 with ResNet18 ONNX INT8 model
Usage
Basic Setup
- Add an Ollama Reranker node to your workflow
- Connect it to a Vector Store node (e.g., Pinecone, Qdrant, Supabase)
- Configure:
- API Type: Choose between:
Ollama Generate API- Standard Ollama prompt-basedCustom Rerank API- Direct reranking endpointVL Classifier + Reranker- Vision-Language classificationAuto-Detect- Automatically detect server type
- Model: Select a reranker model
- Top K: Number of documents to return
- Threshold: Minimum relevance score (0-1)
- Base URL: URL to your server
- API Type: Choose between:
VL Classifier Options (v1.4.0+)
When using VL Classifier:
- Enable VL Classification: Use complexity analysis
- Classification Strategy:
Metadata- Add complexity as document metadataFilter- Filter by complexity before rerankingBoth- Combine filtering and metadata
- Filter Complexity: Keep LOW, HIGH, or both complexity documents
Example Workflow
User Query โ Vector Store (retrieve 50 docs)
โ Ollama Reranker (rerank to top 10)
โ Continue with top-ranked documents
Supported Configurations
Reranker Models (Ollama/Custom API)
| Model | Size | Speed | Accuracy | Best For |
|---|---|---|---|---|
bge-reranker-v2-m3 |
~600MB | โกโกโก | โญโญโญโญ | General purpose (Recommended) |
Qwen3-Reranker-0.6B |
~400MB | โกโกโกโก | โญโญโญ | Low resource environments |
Qwen3-Reranker-4B |
~2.5GB | โกโก | โญโญโญโญ | Balanced performance |
Qwen3-Reranker-8B |
~5GB | โก | โญโญโญโญโญ | Maximum accuracy |
VL Classifier Models
| Model | Size | Speed | Use Case |
|---|---|---|---|
ResNet18-ONNX-INT8 |
11MB | โกโกโกโก | Document complexity classification |
| Custom VL models | Varies | Varies | Vision-Language tasks |
Development
Setup
cd custom-nodes
npm install
Build
npm run build
Lint & Format
npm run lint # Check linting
npm run lint:fix # Auto-fix issues
npm run format # Format code
Test
npm test
Local Testing
Use the included docker-compose.yml:
docker-compose up -d
Access n8n at http://localhost:5678 (admin/admin)
Git Hooks
Pre-commit hooks are configured with Husky to:
- Run lint-staged (ESLint + Prettier)
- Run qlty quality checks
Publishing
Publishing to npm is automated via GitHub Actions:
- Update version in
custom-nodes/package.json - Commit changes
- Create and push a tag:
git tag v1.0.1
git push origin v1.0.1
GitHub Actions will automatically:
- Build the package
- Run tests
- Publish to npm
Project Structure
n8n_reranker/
โโโ custom-nodes/ # Main npm package
โ โโโ src/
โ โ โโโ nodes/
โ โ โโโ OllamaReranker/
โ โ โโโ OllamaReranker.node.ts
โ โ โโโ OllamaReranker.node.test.ts
โ โ โโโ ollama.svg
โ โโโ .eslintrc.js
โ โโโ .husky/ # Git hooks
โ โโโ .prettierrc.json
โ โโโ package.json # Main package.json
โ โโโ tsconfig.json
โ โโโ jest.config.js
โโโ Dockerfile # For local development
โโโ docker-compose.yml # Complete dev environment
โโโ .github/
โโโ workflows/
โโโ npm-publish.yml # Automated publishing
How It Works
The Reranking Challenge
Ollama doesn't natively support reranker models that output relevance scores. Instead, we implement three approaches:
- Prompt-based Scoring: Use Ollama's
/api/generatewith specially formatted prompts - Custom Rerank API: Connect to servers with dedicated
/api/rerankendpoints - VL Classification: Pre-process with Vision-Language models for intelligent filtering
API Type Detection
The node automatically detects your server type by checking:
/api/statusโ VL Classifier server/api/tagsโ Ollama server/api/rerankโ Custom rerank server- Fallback โ Ollama (default)
Architecture
This node implements two n8n patterns:
Provider Node (OllamaReranker)
- No inputs - Provider nodes don't receive workflow data
- AiReranker output - Connects to Vector Store nodes
- supplyData() - Returns a reranker provider object
- Standard interfaces:
rerank()- Main reranking methodcompressDocuments()- LangChain compatibility
Workflow Node (OllamaRerankerWorkflow)
- Main inputs/outputs - Processes workflow items
- execute() - Transforms documents in the workflow
- usableAsTool - Can be used as AI Agent tool
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
Security
- โ No vulnerabilities in dependencies
- โ form-data updated to 4.0.4 (fixes CVE-2025-7783)
- โ Code quality validated with qlty
License
MIT ยฉ Gabriel BRUMENT
Links
- GitHub Repository
- npm Package
- VL Classifier Integration Guide
- n8n Documentation
- Ollama Documentation
Support
For issues and feature requests, please use the GitHub Issues.