npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

n8n-nodes-universal-reranker

v1.0.5

Published

Universal Reranker Node for n8n - supports vLLM, LocalAI, Infinity, Cohere and custom endpoints

Readme

Universal Reranker (n8n Community Node)

Universal Reranker provides document reranking capabilities for n8n workflows. It supports OpenAI-compatible rerank endpoints (vLLM, LocalAI, Infinity, custom) and Cohere Rerank API. The package includes two specialized nodes designed for different use cases.

Nodes

Universal Reranker Provider

AI provider node that connects to vector stores (like PGVector) to rerank retrieved documents. The vector store calls this node automatically during retrieval operations.

Universal Reranker (Flow)

Regular workflow node for reranking document arrays in your n8n flows. You provide the query and document field, and it outputs reranked results.

Installation

Option A - Community Nodes (Recommended)

  1. In n8n: Settings → Community Nodes → Install
  2. Search for "universal reranker" or use package name n8n-nodes-universal-reranker
  3. Restart n8n when prompted

Option B - Self-Hosted Installation

Local Installation:

cd ~/.n8n/custom
npm install n8n-nodes-universal-reranker

Docker Installation:

# Mount custom folder and install inside container
docker exec -it n8n npm install n8n-nodes-universal-reranker

Restart n8n after installation.

Configuration

Service Options

  • OpenAI-Compatible: Works with vLLM, LocalAI, Infinity, and custom endpoints
    • Set Endpoint URL (e.g., http://localhost:7997/rerank)
    • Set Model name (e.g., BAAI/bge-reranker-v2-m3)
  • Cohere: Uses Cohere's rerank API
    • Select from predefined models or choose "Custom" for specific models
    • Requires Cohere API credentials

Parameters

  • Top K: Maximum number of documents to return after reranking
  • Threshold: Minimum relevance score (0-1) for returned documents
  • Include Original Scores: Whether to preserve original document scores
  • Enable Caching: Cache reranking results to improve performance for repeated queries
  • Cache TTL: Time to live for cached results in minutes (1-60, default: 5)
  • Enable Custom Templates: For special models like Qwen3 Reranker (see TEMPLATES.md)

Cohere Models

  • rerank-v3.5 (default)
  • rerank-english-v3.0
  • rerank-multilingual-v3.0
  • Custom: Enter any specific Cohere model name

Caching

Both nodes support optional caching to reduce API calls and improve performance. Caching is disabled by default and can be enabled per node.

Documentation

  • EXAMPLES.md - Usage examples and workflow configurations
  • TEMPLATES.md - Custom template guide for special models (Qwen3, etc.)

Docker Networking

When n8n runs in Docker, use host.docker.internal to access services on your host:

  • Infinity: http://host.docker.internal:7997/rerank
  • vLLM: http://host.docker.internal:8000/v1/rerank
  • LocalAI: http://host.docker.internal:8080/v1/rerank

Troubleshooting

Common Issues

"No documents found in field"

  • Verify your documentsField parameter matches the actual field name
  • Ensure the field contains an array of documents

"API Error (404)"

  • Check that your endpoint URL is correct
  • Verify your reranker service is running and accessible
  • Test the endpoint directly with curl

"Request failed: connect ECONNREFUSED"

  • Ensure your reranker service is accessible from n8n
  • Check Docker network configuration if using containers
  • Verify firewall/security group settings

Debug Mode

Enable debug logging in n8n to see detailed error messages:

export N8N_LOG_LEVEL=debug

Document Format

The nodes expect documents in one of these formats:

  • pageContent field (LangChain format)
  • text field
  • content field
  • document field
  • If none found, the entire document object is stringified

Output includes:

  • _rerankScore: Relevance score from reranking service
  • _originalIndex: Original position in input array
  • _originalScore: Original document score (if includeOriginalScores is true)

Development

Testing

The package includes a comprehensive test suite with 78+ tests covering:

  • Core reranking functionality
  • Caching behavior
  • Error handling and edge cases
  • Both node types (Provider and Flow)
# Run tests
pnpm test

# Run tests with coverage
pnpm run test:coverage

# Build and test
pnpm run prepublishOnly

Contributing

Contributions are welcome!

License

MIT License