n8n AI Agent + Cohere 3.5 Reranker #n8n #aiagents #rag #supabase

The AI AutomatorsAbout 3 min readJun 29, 2025Watch original
THE SUMMARYAI-generated

Key Concepts:

  • Re-ranking: A technique to improve AI agent accuracy by filtering vector store results.
  • Coher's 3.5 Re-ranker Model: A specific re-ranking model natively supported in n8n.
  • Vector Store: A database used to store and retrieve data chunks for AI agents.
  • Hybrid Search: Combining different search methods (e.g., keyword and semantic).
  • Metadata Filtering: Filtering data based on associated metadata.
  • RAG (Retrieval-Augmented Generation): An AI framework that combines information retrieval with text generation.

Setting Up Re-ranking in n8n

  1. Prerequisites:

    • Ensure n8n is updated to the latest stable version (1.98 or later).
    • Have an AI agent configured to use a vector store as a tool for accessing a knowledge base.
  2. Enabling Re-ranking:

    • Open the AI agent in n8n.
    • Locate and enable the "Re-rank results" toggle.
    • A "Re-ranker" leg will appear, allowing the addition of a sub-node.
  3. Configuring Coher Re-ranker:

    • Click the "+" button in the "Re-ranker" leg.
    • Select "Coher" as the re-ranker.
    • Click "Create new credential" to add your Coher API key.
  4. Obtaining Coher API Key:

    • Go to coher.com and create an account.
    • In the Coher dashboard, navigate to "API Keys."
    • Generate a new trial key and copy it.
  5. Adding Coher API Key to n8n:

    • Paste the copied Coher API key into the credential field in n8n.
    • Click "Save."
  6. Selecting Re-ranker Model:

    • Choose the desired Coher re-ranker model. The video uses version 3.5.

Example: Question and Response

  • Question: "What rules govern the power unit of an f1 car?"
  • The question is sent to the AI agent.
  • The agent queries the vector store, retrieving relevant chunks.
  • The retrieved chunks are sent to the Coher re-ranker.
  • Coher's ranker identifies the most relevant results from the knowledge base.
  • The agent generates a response grounded in these re-ranked results.

Benefits of Re-ranking

  • Improved Accuracy: Re-ranking significantly enhances the accuracy of AI agent outputs compared to standard semantic search. Benchmarks demonstrate this improvement.
  • Fine-tuned Responses: Combining re-ranking with techniques like dynamic metadata filtering and hybrid search allows for highly accurate and tailored responses.

Real-World Application: RAG Agent Workflow

  • The video references a RAG agent workflow in the n8n community.
  • This workflow combines re-ranking with dynamic metadata filtering and hybrid search.
  • The result is a system that provides very fine-tuned and accurate responses.

Notable Quotes:

  • "Ranking is a great technique to improve the accuracy of an ai agent by only sending the most relevant chunks returned from a vector store to the agent when formulating a response."
  • "There are benchmarks that show that this technique can dramatically improve the outputs of an ai agent compared to standard semantic search."

Conclusion:

Re-ranking, particularly using Coher's models within n8n, is a powerful technique to enhance the accuracy and relevance of AI agent responses. By filtering the results from a vector store, re-ranking ensures that the agent focuses on the most pertinent information when generating its output. Combining re-ranking with other techniques like hybrid search and metadata filtering can further refine the agent's performance, leading to more accurate and contextually appropriate answers.

AI summaries can miss context or contain errors. Check important details against the original video.

Go a little deeper.

Have a question about this video? Load its transcript to open the video chat.