Documentation Expert Chatbot with Gemini RAG Pipeline - n8n Workflow

Build a specialized, hallucination-free AI documentation expert using RAG (Retrieval-Augmented Generation) in an advanced n8n workflow. This template indexes the n8n docs using Gemini embeddings.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Technical content managers seeking automated and accurate Q&A based on large, proprietary documentation sets.

  • Developers and engineers interested in implementing RAG (Retrieval-Augmented Generation) within a robust n8n workflow environment.

  • Users looking for advanced examples of leveraging Langchain n8n nodes, vector stores, and custom flow control logic, including sub-workflows and memory management.

Overview

The ability to query proprietary or vast document sets accurately is essential for modern AI applications. This advanced n8n workflow provides a complete, production-ready blueprint for implementing a sophisticated RAG pipeline. It elegantly solves the 'hallucination' problem by forcing the AI (Gemini 2.5 Flash) to answer questions based only on the provided, indexed content—in this case, the official n8n documentation. The entire n8n workflow template is divided into two distinct parts: a memory-efficient indexing pipeline that scrapes, chunks, and stores documentation content, and a live, low-latency chatbot powered by an n8n trigger and an AI agent. This powerful n8n workflow demonstrates best practices for managing large-scale data ingestion and retrieval using specialized n8n node types.

How it Works

This n8n workflow operates in two phases: Indexing and Chat.

Phase 1: Indexing the n8n Documentation (The Knowledge Base)


  1. Start Indexing: The flow is manually initiated using the Start Indexing manual n8n trigger node.

  2. Scraping Links: The Get All n8n Documentation Links n8n node performs an HTTP Request to the main documentation page, and the Extract Links from HTML node extracts all links.

  3. Data Cleaning: Nodes like Remove Duplicate Links and Only Keep Doc Paths filter the scraped data, ensuring only valid n8n documentation paths are processed.

  4. Looping and Memory Management: The Loop Over Documentation Pages n8n node splits the paths into batches, utilizing the Execute Workflow n8n node (Add Documentation Page to Vector Store) to call the bottom section as a sub-workflow for each page. This approach is crucial for optimizing memory usage across the thousands of pages.

  5. Page Processing: Inside the sub-workflow, the Get Documentation Page n8n node fetches the content, which is then extracted and cleaned by the Extract Documentation Content and Clean Documentation n8n nodes.

  6. Chunking and Embedding: The cleaned text is passed through the Recursive Character Text Splitter node to create small, overlapping document chunks. The Gemini Chunk Embedding n8n node converts these chunks into numerical vectors (embeddings).

  7. Storage: The Simple Vector Store n8n node (set to 'insert' mode with the key n8ndocumentationvectorstore) saves the text and their corresponding vectors into the in-memory knowledge base, completing the setup for the RAG n8n workflow.

Phase 2: Live Chatbot (Retrieval-Augmented Generation)


  1. The Trigger: The user initiates a conversation via the public URL provided by the RAG Chatbot n8n trigger (Chat Trigger node).

  2. AI Orchestration: The user's query enters the n8n Docs AI Agent n8n node, which acts as the 'brain' of the operation.

  3. Context and Memory: The Simple Memory n8n node provides conversational history, allowing the Agent to understand follow-up questions.

  4. Retrieval Tool: The Agent utilizes the Official n8n Documentation (a Vector Store configured as a tool).

  5. Query Embedding: The user's question is converted into a vector by the Gemini Query Embedding n8n node.

  6. Vector Search: The Vector Store searches the indexed memory (using the key n8ndocumentationvectorstore) to retrieve the top 10 most contextually relevant documentation chunks.

  7. Generation: The Agent combines the question, the conversation history, and the retrieved documentation chunks. It uses the Gemini 2.5 Flash n8n node to synthesize a final, highly accurate answer based exclusively on the provided context, which is then returned to the user via the n8n trigger interface.

Installation Guide

To deploy and use this powerful RAG n8n workflow template, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON and import it directly into your n8n instance via the 'Workflows' menu.

  2. Set up Credentials: This n8n workflow uses Google's Gemini models for embedding and generation. You must configure your Google AI API key.

Go to the Gemini 2.5 Flash n8n node.
Click the Credential dropdown and select + Create New Credential.
Enter your Google AI API Key and save the credential.

  1. Apply Credentials: Ensure all other Gemini-related n8n nodes (Gemini Chunk Embedding, Gemini Query Embedding) are updated to use this new credential.

  2. Run the Indexing Flow: This must be done once to build the knowledge base.

Locate the Start Indexing n8n trigger node at the top-left of the canvas.
Click the 'Execute workflow' button.
Crucial Warning: This process will take 15–20 minutes to scrape and index the entire n8n documentation. Be patient. The memory store is temporary and will be cleared if your n8n instance restarts.

  1. Activate the Chatbot: Once indexing is complete (the workflow run finishes successfully):

Activate the entire n8n workflow using the toggle switch in the top toolbar.
Open the RAG Chatbot n8n trigger node and use its Public URL or 'Open Chat' button to start asking questions of your new n8n documentation expert.

Node Details

Start Indexing (Manual Trigger): The initial n8n trigger point for manually running the documentation ingestion process.
RAG Chatbot (Chat Trigger): The public-facing n8n trigger that captures user input for the live chatbot. It provides the user interface for this n8n workflow.
Get All n8n Documentation Links (HTTP Request): Scrapes the main n8n documentation page to find all available links to process.
Extract Links from HTML (HTML n8n node): Parses the HTML response to extract all href attributes, which are the source paths for the RAG pipeline.
Remove Duplicate Documentation Content (Remove Duplicates n8n node): Crucially configured to 'Remove items seen in previous executions,' ensuring that the expensive embedding process is only run on new or updated documentation pages across multiple runs of the n8n workflow.
Recursive Character Text Splitter (Langchain n8n node): Breaks down large documentation articles into smaller, manageable chunks (1500 characters with 200 character overlap) suitable for high-quality embedding and retrieval.
Gemini Chunk Embedding / Gemini Query Embedding (Langchain Embeddings n8n node): Uses the Gemini model to convert text chunks (for storage) and user queries (for retrieval) into numerical vectors, which is the core of the RAG mechanism.
Simple Vector Store (Langchain Vector Store n8n node): Used in two modes:
insert: To store the newly created documentation chunks and vectors.
retrieve-as-tool: To allow the AI Agent to search the vector database for relevant documents during a chat query.
n8n Docs AI Agent (Langchain Agent n8n node): The control layer that interprets the user's question, manages the conversation flow, and decides when to use the Vector Store tool to retrieve context before generating an answer with the LLM.
Gemini 2.5 Flash (Langchain LLM n8n node): The Large Language Model used by the Agent for synthesizing the final answer based on the retrieved documentation context.

Related n8n Workflows

Free

Nodes: 19 Nodes
Updated: December 26 2025
View all
Created by

Innovative builder with a passion for crafting automation solutions that solve real-world challenges. From streamlining workflows to driving efficiency, my work empowers teams and individuals to achieve more with less effort. Experienced in developing scalable tools and strategies that deliver results with n8n, supabase and cline.

Featured*