{
  "id": "moIGeRuCcLffi7s5",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Local RAG Query Chatbot (n8n + Qdrant + Ollama)",
  "tags": [],
  "nodes": [
    {
      "id": "54b98690-858d-4583-b7dd-769830ebe63b",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -528,
        192
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.4
    },
    {
      "id": "52c90c35-ca93-4979-90ea-61ecca135ee0",
      "name": "Question and Answer Chain",
      "type": "@n8n/n8n-nodes-langchain.chainRetrievalQa",
      "position": [
        -112,
        192
      ],
      "parameters": {
        "options": {
          "systemPromptTemplate": "You are answering questions about a document using ONLY the retrieved context provided below. Do not use outside knowledge, and do not guess.\n\nRules:\n- Read the ENTIRE retrieved context before answering. If a passage contains conditions, exceptions, or qualifications, include them \u2014 a partial answer that omits a condition is treated as incorrect.\n- If the retrieved context does not contain enough information to answer the question, say so plainly. Do not fabricate an answer or fill gaps with assumptions.\n- Prefer quoting or closely paraphrasing the source over loose summarizing.\n- Keep the answer concise and directly relevant to the question asked.\n- If asked about anything outside the retrieved context, state that it isn't covered by the indexed document.\n{context}"
        }
      },
      "typeVersion": 1.7
    },
    {
      "id": "e61a3785-0654-4f3f-9aeb-362b5f632e64",
      "name": "Ollama Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "position": [
        -336,
        352
      ],
      "parameters": {
        "model": "qwen2.5:7b",
        "options": {}
      },
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a8e6ab3f-07f4-4335-a07c-231840c0b973",
      "name": "Vector Store Retriever",
      "type": "@n8n/n8n-nodes-langchain.retrieverVectorStore",
      "position": [
        0,
        352
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "461147cd-9621-42a2-8385-86f47a5345a9",
      "name": "Qdrant Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        0,
        480
      ],
      "parameters": {
        "options": {},
        "qdrantCollection": {
          "__rl": true,
          "mode": "list",
          "value": "handbook",
          "cachedResultName": "handbook"
        }
      },
      "credentials": {
        "qdrantApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "b78190ee-8681-4f14-96f6-281a8f0ec4ea",
      "name": "Embeddings Ollama",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "position": [
        64,
        624
      ],
      "parameters": {
        "model": "nomic-embed-text:latest"
      },
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ae95ab5d-8d3e-49af-a29f-cd897980f168",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -32
      ],
      "parameters": {
        "color": "#3B0202",
        "height": 96,
        "content": "LOCAL DOCUMENT INTELLIGENCE PIPELINE (ZERO DATA LEAKAGE)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4ffc5cb4-8f84-4ad5-bdca-d589ca6431e4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        -32
      ],
      "parameters": {
        "color": "#000000",
        "width": 720,
        "height": 80,
        "content": "Stack: n8n + Qdrant Vector Store + Local Ollama (nomic-embed-text / qwen2.5:7b)\nSecurity: 100% Local Execution | No OpenAI API Keys | Client Documents Stay On-Premise"
      },
      "typeVersion": 1
    },
    {
      "id": "e1e889b7-08a0-4a1f-b564-db958ddaa3e1",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        480
      ],
      "parameters": {
        "color": 4,
        "content": "SETUP STEP 1: Requires Ollama running locally with\nqwen2.5:7b installed. \n\nIn your terminal run:\nollama pull qwen2.5:7b\n"
      },
      "typeVersion": 1
    },
    {
      "id": "29b77d7c-cef2-426f-8f58-6c97d3ff93d3",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        464
      ],
      "parameters": {
        "color": 4,
        "width": 448,
        "height": 112,
        "content": "SETUP STEP 2: Set the SAME Collection Name you used\nin the Index workflow. If these two don't match exactly,\nthis workflow will return no results.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "441f6f56-3f8a-46bf-848f-8e8896546aef",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        160
      ],
      "parameters": {
        "height": 240,
        "content": "REQUIRES: Run the Index workflow first to load your\ndocument into Qdrant. \n\nThis workflow can only answer\nquestions about documents that have already been indexed.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b712ed33-21b6-4fe7-97d2-cee548af4796",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        752
      ],
      "parameters": {
        "width": 272,
        "height": 96,
        "content": "HOW TO TEST: Click \"Open chat\" below and ask a question\nabout your indexed document.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "8d09067e-0fba-4f0f-9179-ef0d4dfb754d",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        96
      ],
      "parameters": {
        "color": 6,
        "width": 384,
        "height": 304,
        "content": "Known limitation: retrieval quality depends on the Vector\n\nStore Retriever's Top K setting. With the default value, multi-fact questions (e.g. \"which sectors are represented\") may retrieve an incomplete set of chunks and the assistant will correctly decline rather than guess. \n\nIncrease Top K on the retriever node if you need broader recall."
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "binaryMode": "separate",
    "callerPolicy": "workflowsFromSameOwner",
    "timeSavedMode": "dynamic",
    "availableInMCP": false,
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "saveExecutionProgress": true,
    "saveDataErrorExecution": "all",
    "saveDataSuccessExecution": "all"
  },
  "versionId": "b97cb73d-d2ce-4902-b954-7cc297084f36",
  "nodeGroups": [],
  "connections": {
    "Embeddings Ollama": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Question and Answer Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store": {
      "ai_vectorStore": [
        [
          {
            "node": "Vector Store Retriever",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Vector Store Retriever": {
      "ai_retriever": [
        [
          {
            "node": "Question and Answer Chain",
            "type": "ai_retriever",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Question and Answer Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}