AutomationFlowsAI & RAG › Build Self-Hosted RAG with Qdrant and Ollama

Build Self-Hosted RAG with Qdrant and Ollama

Original n8n title: Implement On-prem RAG with Qdrant and Ollama for a Self-hosted Kb

ByMabura Ze Guru @zeguru on n8n.io

Provides one workflow to maintain the knowledge base and another one to query the knowledge base. Uploaded documents are saved into the Qdrant vector store. When a query is made, the most relevant documents are retrieved from the vector store and sent to the LLM as context for…

Chat trigger trigger★★★☆☆ complexityAI-powered12 nodesDocument Default Data LoaderOllama EmbeddingsChat TriggerAgentOllama ChatMemory Buffer WindowQdrant Vector StoreForm Trigger
AI & RAG Trigger: Chat trigger Nodes: 12 Complexity: ★★★☆☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #13422 — we link there as the canonical source.

This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "KXXAFjp2GaYwDN3BDjjML",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Self hosted RAG using Ollama and Qdrant",
  "tags": [],
  "nodes": [
    {
      "id": "80b20667-49e6-4d2a-9e0a-aa159ff701da",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        112,
        96
      ],
      "parameters": {
        "options": {
          "splitPages": true
        },
        "dataType": "binary"
      },
      "typeVersion": 1.1
    },
    {
      "id": "02ffa064-6225-41ab-8952-6e2ca52f3a0f",
      "name": "Embeddings Ollama",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "position": [
        352,
        560
      ],
      "parameters": {
        "model": "nomic-embed-text:latest"
      },
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c45b9793-b55c-43e1-8b48-539a9e7e3bd2",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        -176
      ],
      "parameters": {
        "width": 528,
        "height": 1200,
        "content": "\n## Try It\n### This n8n template provides a self hosted RAG implementation.\n\n### How it works\n* Provides one workflow to maintain the knowledge base and another one to query the knowledge base.\n* Uploaded documents are saved into the Qdrant vector store.\n* When a query is made, the most relevant documents are retrieved from the vector store and sent to the LLM as context for generating a response.\n\n\n### How to use\n* Start the workflow by clicking **Execute workflow**\n* Use the file upload form to upload a document into the knowledge base (Qdrant db).\n* Click **Open chat** to start asking questions related to the uploaded documents.\n\n### Setup steps\nBelow steps show how to setup on Amazon Linux. Consult your OS for respective steps\n\n* Install Ollama on prem\n```\nmkdir ollama\ncd ollama\ncurl -fsSL https://ollama.com/install.sh | sh\nollama --version\n```\n* Install required models ( in Amazon Linux)\n\n```\n ollama pull llama3:8b\n ollama pull mistral:7b\n ollama pull nomic-embed-text:latest\n```\n* Access ollama via http://localhost:11434\n* Fire up Qdrant  (e.g.  via docker)\n`docker run -p 6333:6333 qdrant/qdrant`. \n* Access Qdrant via `http://localhost:6333/dashboard` \n* Create a Qdrant collection named `knowledge-base` configured with vector length of 768.\n* NB: Do not forget a persistent docker volume for Qdrant if you want to keep the data when using docker.\n* Point the nodes to the respective on premise Qdrant and Ollama runtimes.\n\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!\n\nHappy RAGing!"
      },
      "typeVersion": 1
    },
    {
      "id": "4e3202d4-7b64-49a1-8f7f-63f2cd02e815",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 704,
        "height": 496,
        "content": "## 1. Update Knowledge base\n"
      },
      "typeVersion": 1
    },
    {
      "id": "3306b8ee-e953-4218-9f7e-60a10cc26c66",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        608,
        -80
      ],
      "parameters": {
        "public": true,
        "options": {
          "responseMode": "lastNode"
        },
        "initialMessages": "Kwema ? \ud83d\udc4b\nMy name is KB. How can I assist you today?"
      },
      "typeVersion": 1.4
    },
    {
      "id": "4aaafa6c-286b-495e-a87b-87e76b789862",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        832,
        -80
      ],
      "parameters": {
        "options": {
          "systemMessage": "FORCE TOOL USAGE. DO NOT guess. \nALWAYS use the Vector Store tool before answering.\nFetch relevant info from the Qdrant vector store. \nUse the retrieved results to answer the user query.\n\n"
        }
      },
      "typeVersion": 3.1
    },
    {
      "id": "1cf662db-7d82-4b09-9f6b-1025d694615a",
      "name": "Ollama Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "position": [
        640,
        128
      ],
      "parameters": {
        "model": "mistral:7b",
        "options": {
          "topK": -1
        }
      },
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "068c18a2-bc98-4975-851e-c6fe462d6753",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 816,
        "height": 496,
        "content": "## 2. Query Knowledge base"
      },
      "typeVersion": 1
    },
    {
      "id": "b9f2ba62-e432-43e3-952e-261b83420229",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        848,
        128
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "4072d63b-b349-4089-909b-839e5fb33567",
      "name": "Add to Qdrant Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        -80,
        -64
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "qdrantCollection": {
          "__rl": true,
          "mode": "list",
          "value": "knowledge-base",
          "cachedResultName": "knowledge-base"
        }
      },
      "credentials": {
        "qdrantApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "019770da-2265-46d4-848f-a3e9305f401d",
      "name": "Read from Qdrant Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        992,
        128
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "topK": 3,
        "options": {},
        "toolDescription": "ALWAYS Use this knowledge base to answer questions from the user",
        "qdrantCollection": {
          "__rl": true,
          "mode": "list",
          "value": "knowledge-base",
          "cachedResultName": "knowledge-base"
        },
        "includeDocumentMetadata": false
      },
      "credentials": {
        "qdrantApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "5a942bd4-8794-442d-a751-f50eb9c62b88",
      "name": "Upload document",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -288,
        -64
      ],
      "parameters": {
        "options": {},
        "formTitle": "Upload",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Doc Name"
            },
            {
              "fieldType": "file",
              "fieldLabel": "File"
            }
          ]
        },
        "formDescription": "Poor mans Knowledge base"
      },
      "typeVersion": 2.5
    }
  ],
  "active": true,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "b286da3a-10bc-42d3-9808-97fe23e4f691",
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Upload document": {
      "main": [
        [
          {
            "node": "Add to Qdrant Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Ollama": {
      "ai_embedding": [
        [
          {
            "node": "Add to Qdrant Vector Store",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "Read from Qdrant Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Add to Qdrant Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read from Qdrant Vector Store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Provides one workflow to maintain the knowledge base and another one to query the knowledge base. Uploaded documents are saved into the Qdrant vector store. When a query is made, the most relevant documents are retrieved from the vector store and sent to the LLM as context for…

Source: https://n8n.io/workflows/13422/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

⚠️ Note: This system only works for self-hosted n8n instances. It will not function on n8n.cloud or other remote setups. LocalRAG.AI is a private, on-prem AI assistant that uses your own documents to

Chat Trigger, Agent, Ollama Chat +9
AI & RAG

Poc-Rag-Llm. Uses lmChatOllama, embeddingsOllama, chatTrigger, agent. Chat trigger; 12 nodes.

Ollama Chat, Ollama Embeddings, Chat Trigger +4
AI & RAG

RAG Agent Integration Hub mit Knowledge Management. Uses memoryPostgresChat, lmChatOllama, lmOllama, toolVectorStore. Chat trigger; 27 nodes.

Memory Postgres Chat, Ollama Chat, Lm Ollama +8
AI & RAG

This workflow transforms your n8n instance into a fully automated AI sales assistant for WooCommerce stores. It detects customer intent from chat, searches products, answers FAQs, generates Stripe pay

Chat Trigger, Memory Buffer Window, Information Extractor +13
AI & RAG

Automate Siem Alert Enrichment With Mitre Att&Ck, Qdrant & Zendesk In N8N. Uses chatTrigger, agent, lmChatOpenAi, splitOut. Chat trigger; 26 nodes.

Chat Trigger, Agent, OpenAI Chat +8