{
  "name": "🤖 Build a Documentation Expert Chatbot with Gemini RAG Pipeline",
  "nodes": [
    {
      "id": "26bd501a-d449-4bbf-aa25-a02e5cca7964",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -768,
        320
      ]
    },
    {
      "id": "2916c373-0c6b-4315-a14d-481d674a324f",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        944,
        -1200
      ]
    },
    {
      "id": "8b411025-ad1f-4656-84d7-902ced049923",
      "name": "Recursive Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1040,
        -992
      ]
    },
    {
      "id": "4855516e-4a0d-4881-8dc4-592cf8b133a9",
      "name": "Remove Duplicate Documentation Content",
      "type": "n8n-nodes-base.removeDuplicates",
      "position": [
        320,
        -1424
      ]
    },
    {
      "id": "a33a791a-e328-46fc-890e-e18649ab2231",
      "name": "Only Keep Doc Paths",
      "type": "n8n-nodes-base.filter",
      "position": [
        448,
        -2192
      ]
    },
    {
      "id": "b07b416b-f5cd-439a-b935-ce58c2a2f180",
      "name": "Clean Documentation",
      "type": "n8n-nodes-base.set",
      "position": [
        -112,
        -1424
      ]
    },
    {
      "id": "4198449e-feb7-43f2-be23-e8581ff9fd98",
      "name": "Gemini 2.5 Flash",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -1120,
        320
      ]
    },
    {
      "id": "e1bad122-5df4-4018-8b50-fc67f70b55b7",
      "name": "Get All n8n Documentation Links",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -704,
        -2192
      ]
    },
    {
      "id": "626cf083-8ae3-4e28-96d2-92b01f6d36cd",
      "name": "Extract Links from HTML",
      "type": "n8n-nodes-base.html",
      "position": [
        -416,
        -2192
      ]
    },
    {
      "id": "e980ad18-7857-4603-8e01-9a98520dd874",
      "name": "Split Out Links",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -80,
        -2192
      ]
    },
    {
      "id": "2b441068-ead3-4114-baca-f26f95c2c2eb",
      "name": "Remove Duplicate Links",
      "type": "n8n-nodes-base.removeDuplicates",
      "position": [
        224,
        -2192
      ]
    },
    {
      "id": "a9196d50-2a7a-4733-b6e4-2cb03a5cda46",
      "name": "Add Documentation Page to Vector Store",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        960,
        -2160
      ]
    },
    {
      "id": "1c772047-a2f9-427a-b090-dbf00a257c9c",
      "name": "Get Documentation Page",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -640,
        -1424
      ]
    },
    {
      "id": "d7cd75ad-e76d-45c7-8791-e6b9cf0e2106",
      "name": "Extract Documentation Content",
      "type": "n8n-nodes-base.html",
      "position": [
        -336,
        -1424
      ]
    },
    {
      "id": "5ac3f64f-0340-4a98-bace-1c156021a919",
      "name": "Gemini Query Embedding",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        -400,
        512
      ]
    },
    {
      "id": "cbcc6097-c4a7-45d4-a852-5ab69d8f1e14",
      "name": "Gemini Chunk Embedding",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        816,
        -1200
      ]
    },
    {
      "id": "ba1f2848-bd94-4180-8edd-38150cda7f0b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1296,
        -2544
      ],
      "parameters": {
        "width": 2640,
        "height": 1760,
        "content": "## Part 1: Building the Knowledge Base (The Library)\n\n**Goal:** To read all n8n documentation, break it into small pieces, and store it in n8n's **in-memory vector store**.\n**Action:** You only need t"
      }
    },
    {
      "id": "3cda1636-2dfd-46c0-8d82-d072e7be673e",
      "name": "Loop Over Documentation Pages",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        736,
        -2192
      ]
    },
    {
      "id": "ffa9c491-00d0-4c70-8a59-64f627b6468f",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2256,
        -3088
      ],
      "parameters": {
        "width": 1064,
        "height": 520,
        "content": "# Tutorial: Build an AI Expert with RAG\n\nWelcome! This workflow teaches you **RAG (Retrieval-Augmented Generation)** using n8n's built-in tools.\n\n**The Goal:** To create an AI chatbot that is an exper"
      }
    },
    {
      "id": "6f33666c-868b-4032-99c6-9844a809a587",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2256,
        -2544
      ],
      "parameters": {
        "width": 924,
        "height": 1392,
        "content": "# Workflow Setup"
      }
    },
    {
      "id": "6b8d3bba-6a47-4dc6-b970-219a35863782",
      "name": "n8n Docs AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -752,
        -288
      ]
    },
    {
      "id": "6a7912bb-20a6-44bc-ab08-7a1e227797ab",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        -2400
      ],
      "parameters": {
        "width": 288,
        "height": 400,
        "content": "### Step 1.1: Find All the 'Books'\n\n**What it does:** This node visits the main n8n documentation page.\n**Analogy:** We're asking the library's front desk for a complete list of every single book they"
      }
    },
    {
      "id": "a094ca81-3cb1-42b3-bcce-202da80ac5ea",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        -2400
      ],
      "parameters": {
        "width": 272,
        "height": 400,
        "content": "### Step 1.2: Read the List of Books\n\n**What it does:** It takes the HTML from the previous step and extracts every single link (`<a>` tag).\n**Analogy:** We're reading the list from the front desk and"
      }
    },
    {
      "id": "d3c9c411-34fb-4f5e-a46e-a1cfb5130f53",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        -2400
      ],
      "parameters": {
        "width": 336,
        "height": 400,
        "content": "### Step 1.3: Process One Book at a Time\n\n**What it does:** It takes the big list of links and turns each link into a separate item for n8n to process.\n**Analogy:** Instead of trying to read all the b"
      }
    },
    {
      "id": "0cec3147-5420-4f89-8dd9-b49462e6a631",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        -2400
      ],
      "parameters": {
        "width": 480,
        "height": 400,
        "content": "### Step 1.4: Tidy Up the To-Do List\n\n**What it does:** First, it removes any duplicate links. Then, it filters out any links that don't point to an actual documentation page (e.g., links to the homep"
      }
    },
    {
      "id": "abf15718-553e-4226-8e85-28a7e2864c34",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -2400
      ],
      "parameters": {
        "width": 512,
        "height": 464,
        "content": "### Step 1.5: The Librarian's Reading Loop\n\n**What it does:** This is the engine of the indexing process. It takes our clean list of pages and processes them one by one. The `Execute Workflow` node ca"
      }
    },
    {
      "id": "162390aa-5dfa-4e2d-ad27-59bd00eea840",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -736,
        -1632
      ],
      "parameters": {
        "width": 288,
        "height": 384,
        "content": "### Step 1.5.1: Read a Single Page\n\n**What it does:** This node takes a single URL from the loop and fetches the HTML content of that page.\n**Analogy:** The librarian opens one book to the first page."
      }
    },
    {
      "id": "c516a2da-d6c1-4da7-8a30-4540af69c2f0",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1264,
        -1776
      ],
      "parameters": {
        "width": 512,
        "height": 528,
        "content": "### Why Use a Sub-Workflow?\n\nThe main reason is **memory management**.\n\nProcessing a single web page, especially creating vector embeddings for all its chunks, uses a lot of memory (RAM). The n8n docu"
      }
    },
    {
      "id": "c2474781-cffe-48e5-a8c3-c19b30821ab6",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        -1632
      ],
      "parameters": {
        "width": 512,
        "height": 384,
        "content": "### Step 1.5.2: Get the Good Stuff\n\n**What it does:** It extracts only the main text from the article on the page, ignoring menus, footers, and images. Then, it cleans up the formatting.\n**Analogy:** "
      }
    },
    {
      "id": "70fbb1bd-1cfd-47ed-ad46-48f1d7ee9194",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        -1856
      ],
      "parameters": {
        "width": 544,
        "height": 608,
        "content": "### Step 1.5.3: Avoid Re-reading\n\n**What it does:** It checks if we have already processed this exact page content in a previous run. If so, it stops here to save time and resources.\n**Analogy:** The "
      }
    },
    {
      "id": "88930b6a-5ffb-428b-bdb3-689cda2f78d8",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        -1856
      ],
      "parameters": {
        "width": 656,
        "height": 1040,
        "content": "### Step 1.5.4: Create & Store the 'Magic Index Cards'\n\nThis is the most important step of indexing!\n\n1.  **`Recursive Character Text Splitter`:** The text is broken down into small, overlapping parag"
      }
    },
    {
      "id": "cb9f3d2c-6eaf-4b6e-aa7f-d0662bc35740",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1296,
        -752
      ],
      "parameters": {
        "width": 1200,
        "height": 1456,
        "content": "## Part 2: The Chatbot (Talking to the Expert Librarian)\n\n**Goal:** To provide an interface where a user can ask a question, have the system find relevant information from the knowledge base, and get "
      }
    },
    {
      "id": "ae93c028-a7d2-4d05-b3a7-9789dd4211f9",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1264,
        -592
      ],
      "parameters": {
        "width": 368,
        "height": 448,
        "content": "### The Front Desk: Ask Your Question Here\n\n**What it does:** This is the public-facing chat interface. When you send a message here, the entire RAG process begins.\n\n**Action:**\n1.  **Activate** the e"
      }
    },
    {
      "id": "d180b0ca-dd3b-40bb-8595-c178f74011e6",
      "name": "Sticky Note18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        -480
      ],
      "parameters": {
        "width": 560,
        "height": 400,
        "content": "### The Brains: The Expert Librarian\n\n**What it does:** This is the AI agent that orchestrates the entire response. It understands your question, decides which tools to use, and formulates the final a"
      }
    },
    {
      "id": "42d81e12-bfc9-4b9b-bb8a-40249e163bbb",
      "name": "Sticky Note19",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1264,
        -128
      ],
      "parameters": {
        "width": 368,
        "height": 592,
        "content": "### The 'Synthesizer' & 'Strategist'\n\n**What it does:** This is the Large Language Model (LLM). It has two critical jobs:\n\n1.  **The Strategist:** Based on your question and the conversation history, "
      }
    },
    {
      "id": "567ecaf4-e42a-4275-bc39-ad7217b4a173",
      "name": "Sticky Note20",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        -64
      ],
      "parameters": {
        "width": 288,
        "height": 528,
        "content": "### Short-Term Memory\n\n**What it does:** This node stores the last few messages of your conversation.\n**Analogy:** This helps the librarian remember what you just talked about, so you can ask follow-u"
      }
    },
    {
      "id": "120f0062-4e6c-4cac-92ab-51cd7b55e892",
      "name": "Sticky Note21",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        -64
      ],
      "parameters": {
        "width": 448,
        "height": 736,
        "content": "### The Tool: The 'Magic Filing Cabinet' Retriever\n\nThis is the \"Retrieval\" part of RAG. When the agent gets your question, it uses this tool to find the most relevant information.\n\n1.  **`Gemini Quer"
      }
    },
    {
      "id": "b83a63ac-403f-4717-ae8a-6756e42f4b3e",
      "name": "Start Indexing",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -944,
        -2192
      ]
    },
    {
      "id": "1271281d-ab81-4039-96a3-0bc42024d6f8",
      "name": "RAG Chatbot",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1104,
        -288
      ]
    },
    {
      "id": "2ff38f0f-91ef-45c0-a419-ffeffe9bfea3",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2224,
        -1504
      ],
      "parameters": {
        "width": 624,
        "height": 320,
        "content": "## Setup Step 4: Chat with Your Expert!\n\nCongratulations, the knowledge base is built! Now it's time to ask the expert a question.\n\n**Action:**\n1.  **Activate** the entire workflow using the toggle sw"
      }
    },
    {
      "id": "a42e96aa-a212-4fd8-b3f5-b70738428112",
      "name": "Sticky Note24",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2224,
        -2464
      ],
      "parameters": {
        "width": 656,
        "height": 272,
        "content": "## Setup Step 1: Connect Your Google AI Credentials\n\nThis workflow uses Google's Gemini models for generating embeddings and chat responses. You'll need a Google AI API key.\n\n**Action:**\n1.  Go to any"
      }
    },
    {
      "id": "22d91015-7d89-4f1c-bd30-cc1387cc24a3",
      "name": "Sticky Note27",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2224,
        -2176
      ],
      "parameters": {
        "width": 864,
        "height": 304,
        "content": "## Setup Step 2: Apply Credentials to All Gemini Nodes\n\nYour new Google AI credential is now saved. Let's make sure all the other Gemini nodes are using it.\n\n**Action:**\nGo to the remaining Gemini nod"
      }
    },
    {
      "id": "497629d6-8b1b-4ab8-9e37-98d21da5fdc2",
      "name": "Sticky Note28",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2224,
        -1856
      ],
      "parameters": {
        "width": 784,
        "height": 336,
        "content": "## Setup Step 3: Build the Knowledge Base (Indexing)\n\nThis is the one-time step where the AI \"reads\" all the documentation.\n\n**Action:**\n1.  Find the **`Start Indexing`** manual trigger node at the to"
      }
    },
    {
      "id": "7ab75be6-6cc7-4306-8f84-b101855cb65d",
      "name": "Ingest Web Page",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -944,
        -1424
      ]
    },
    {
      "id": "6e3fc66d-e12e-4ef3-81c8-a205be1c26a0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        -752
      ],
      "parameters": {
        "width": 832,
        "height": 544,
        "content": "## Video Tutorial\n\nA full video tutorial about RAG will be shown here in a future version of this template !"
      }
    },
    {
      "id": "85ff7226-9931-41d7-9ca5-c9a6f153fe26",
      "name": "Simple Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        848,
        -1424
      ]
    },
    {
      "id": "e11b64ae-32ce-4fde-aba8-bbf6744b9edd",
      "name": "Official n8n Documentation",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        -496,
        320
      ]
    },
    {
      "id": "677af764-b9e7-4478-8846-c7cf3ab4c42d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        -752
      ],
      "parameters": {
        "width": 544,
        "height": 1088,
        "content": "## Was this helpful? Let me know!\n[![clic](https://supastudio.ia2s.app/storage/v1/object/public/assets/n8n/clic_down_lucas.gif)](https://workflows.ac/form)\n\nI really hope this template helped you. You"
      }
    }
  ],
  "connections": {
    "RAG Chatbot": {
      "main": [
        [
          {
            "node": "n8n Docs AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "n8n Docs AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Start Indexing": {
      "main": [
        [
          {
            "node": "Get All n8n Documentation Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ingest Web Page": {
      "main": [
        [
          {
            "node": "Get Documentation Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Links": {
      "main": [
        [
          {
            "node": "Remove Duplicate Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini 2.5 Flash": {
      "ai_languageModel": [
        [
          {
            "node": "n8n Docs AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Clean Documentation": {
      "main": [
        [
          {
            "node": "Remove Duplicate Documentation Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Simple Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Only Keep Doc Paths": {
      "main": [
        [
          {
            "node": "Loop Over Documentation Pages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Chunk Embedding": {
      "ai_embedding": [
        [
          {
            "node": "Simple Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Query Embedding": {
      "ai_embedding": [
        [
          {
            "node": "Official n8n Documentation",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Get Documentation Page": {
      "main": [
        [
          {
            "node": "Extract Documentation Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicate Links": {
      "main": [
        [
          {
            "node": "Only Keep Doc Paths",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Links from HTML": {
      "main": [
        [
          {
            "node": "Split Out Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Official n8n Documentation": {
      "ai_tool": [
        [
          {
            "node": "n8n Docs AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Extract Documentation Content": {
      "main": [
        [
          {
            "node": "Clean Documentation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Documentation Pages": {
      "main": [
        [],
        [
          {
            "node": "Add Documentation Page to Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get All n8n Documentation Links": {
      "main": [
        [
          {
            "node": "Extract Links from HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Add Documentation Page to Vector Store": {
      "main": [
        [
          {
            "node": "Loop Over Documentation Pages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicate Documentation Content": {
      "main": [
        [
          {
            "node": "Simple Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}