AutomationFlowsAI & RAG › Create a Private Document Q&a System with Llama3, Postgres, Qdrant and…

Create a Private Document Q&a System with Llama3, Postgres, Qdrant and…

Original n8n title: Create a Private Document Q&a System with Llama3, Postgres, Qdrant and Google Drive

ByDavid Olusola @dae221 on n8n.io

⚠️ 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 answer questions intelligently. It combines LangChain, Ollama, Qdrant, and…

Chat trigger trigger★★★★☆ complexityAI-powered20 nodesChat TriggerAgentOllama ChatMemory Postgres ChatQdrant Vector StoreLm OllamaOllama EmbeddingsTool Vector Store
AI & RAG Trigger: Chat trigger Nodes: 20 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #5508 — 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": "VqgG9dsRgPuxiNDW",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "n8n local test",
  "tags": [],
  "nodes": [
    {
      "id": "250ff8ae-f645-4644-af93-f2148549ed86",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -940,
        580
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "fbcc24b9-f983-49af-a7b9-dc78277e746c",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -660,
        560
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a helpful assistant you have access to a knowledge base"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "03cfe40b-62ca-41af-ba97-80072e018e3d",
      "name": "Ollama Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "position": [
        -840,
        400
      ],
      "parameters": {
        "model": "llama3.2:latest",
        "options": {}
      },
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5c16650c-44a9-4c5f-b8f2-d0e9e5a0f41d",
      "name": "Postgres Chat Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "position": [
        -720,
        380
      ],
      "parameters": {},
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "d975770d-0463-480c-aa70-33395f5f40b2",
      "name": "Qdrant Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        660,
        460
      ],
      "parameters": {
        "options": {},
        "qdrantCollection": {
          "__rl": true,
          "mode": "list",
          "value": "midjourney",
          "cachedResultName": "midjourney"
        }
      },
      "credentials": {
        "qdrantApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "a5282142-d4dc-40b9-bff9-93df5fc5905f",
      "name": "Ollama Model",
      "type": "@n8n/n8n-nodes-langchain.lmOllama",
      "position": [
        400,
        360
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "76a8d5b3-0c41-4f6c-b3c1-6a00ce555b23",
      "name": "Embeddings Ollama",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "position": [
        480,
        520
      ],
      "parameters": {},
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3d6d64f3-b1d3-4453-9f17-6d3a55273407",
      "name": "Answer questions with a vector store",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        620,
        320
      ],
      "parameters": {
        "description": "this tool will be used to retrieve knowledge"
      },
      "typeVersion": 1.1
    },
    {
      "id": "312d4235-a534-45f2-8cba-475b12874281",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        320
      ],
      "parameters": {
        "color": 7,
        "width": 660,
        "height": 480,
        "content": "## Local Rag AI AGENT  \n"
      },
      "typeVersion": 1
    },
    {
      "id": "832d366c-3eb4-4845-8661-067fc12d278b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        240
      ],
      "parameters": {
        "color": 4,
        "width": 720,
        "height": 460,
        "content": "## Qdrant Vector store and Ollama Embeddings\n"
      },
      "typeVersion": 1
    },
    {
      "id": "49d25a7c-432c-4794-ad49-c6dc57685120",
      "name": "File Created",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -760,
        900
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1uf6zZN51rgAuQgid4-Oi314f6mJIQdiB",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1uf6zZN51rgAuQgid4-Oi314f6mJIQdiB",
          "cachedResultName": "Daex"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "39b32d2b-b4c7-44de-8f86-f519be58e4b5",
      "name": "File Updated",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -760,
        1100
      ],
      "parameters": {
        "event": "fileUpdated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1914m3M7kRzkd5RJqAfzRY9EBcJrKemZC",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1914m3M7kRzkd5RJqAfzRY9EBcJrKemZC",
          "cachedResultName": "Meeting Notes"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b5cf9dc7-7bd9-41a3-b736-6417de3cf4b0",
      "name": "Set File ID",
      "type": "n8n-nodes-base.set",
      "position": [
        -540,
        1000
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "10646eae-ae46-4327-a4dc-9987c2d76173",
              "name": "file_id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "dd0aa081-79e7-4714-8a67-1e898285554c",
              "name": "folder_id",
              "type": "string",
              "value": "={{ $json.parents[0] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "fee137e8-a785-4a07-a3f7-84f1d15438f8",
      "name": "Download File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -100,
        1000
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Set File ID').item.json.file_id }}"
        },
        "options": {
          "googleFileConversion": {
            "conversion": {
              "docsToFormat": "text/plain"
            }
          }
        },
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 3
    },
    {
      "id": "03adfdbf-1dc4-48c4-9263-5660f1abb505",
      "name": "Extract Document Text",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        120,
        1000
      ],
      "parameters": {
        "options": {},
        "operation": "text"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "5490338c-f7a4-4e14-a493-b2f3d60af56f",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        460,
        1222.5
      ],
      "parameters": {
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "file_id",
                "value": "={{ $('Set File ID').item.json.file_id }}"
              },
              {
                "name": "folder_id",
                "value": "={{ $('Set File ID').item.json.folder_id }}"
              }
            ]
          }
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1bcb0f4f-92bb-40e6-a1a9-2a2acd232202",
      "name": "Recursive Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        548,
        1420
      ],
      "parameters": {
        "options": {},
        "chunkSize": 100
      },
      "typeVersion": 1
    },
    {
      "id": "f3f1d04c-050e-4aa6-85b1-cbb4b3eaf591",
      "name": "Embeddings Ollama1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "position": [
        340,
        1220
      ],
      "parameters": {
        "model": "llama3.2:latest"
      },
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "066b5093-a034-43e8-a5ea-72aea5770d6c",
      "name": "Qdrant Vector Store Insert",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        340,
        980
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "qdrantCollection": {
          "__rl": true,
          "mode": "list",
          "value": "midjourney",
          "cachedResultName": "midjourney"
        }
      },
      "credentials": {
        "qdrantApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d85eda28-8be7-4b0d-97bf-254c39a3f690",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -806.5,
        855
      ],
      "parameters": {
        "color": 5,
        "width": 1568.9362829025763,
        "height": 705.2695614889159,
        "content": "## Workflow to Create Local Knowledgebase from Google Drive Folder"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ecc4d322-242f-4c1e-a43a-18d79efde064",
  "connections": {
    "Set File ID": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File Created": {
      "main": [
        [
          {
            "node": "Set File ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File Updated": {
      "main": [
        [
          {
            "node": "Set File ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Model": {
      "ai_languageModel": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Extract Document Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Ollama": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Ollama1": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store Insert",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Qdrant Vector Store Insert",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store": {
      "ai_vectorStore": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Extract Document Text": {
      "main": [
        [
          {
            "node": "Qdrant Vector Store Insert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Answer questions with a 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

⚠️ 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 answer questions intelligently. It combines LangChain, Ollama, Qdrant, and…

Source: https://n8n.io/workflows/5508/ — 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

This workflow acts as a 24/7 sales agent, engaging leads across WhatsApp, Instagram, Facebook, Telegram, and your website. It intelligently transcribes audio messages, answers questions using a knowle

Chat Trigger, Memory Postgres Chat, Tool Workflow +20
AI & RAG

• Create a Google Drive folder to watch. • Connect your Google Drive account in n8n and authorize access. • Point the Google Drive Trigger node to this folder (new/modified files trigger the flow).

Agent, Chat Trigger, Memory Buffer Window +14
AI & RAG

⚡AI-Powered YouTube Playlist & Video Summarization and Analysis v2. Uses lmChatGoogleGemini, agent, splitOut, chainLlm. Chat trigger; 72 nodes.

Google Gemini Chat, Agent, Chain Llm +11
AI & RAG

This n8n workflow transforms entire YouTube playlists or single videos into interactive knowledge bases you can chat with. Ask questions and get summaries without needing to watch hours of content. 🔗

Google Gemini Chat, Agent, Chain Llm +11
AI & RAG

The workflow operates through a three-step process that handles incoming chat messages with intelligent tool orchestration: Message Trigger: The node triggers whenever a user message arrives and passe

Chat Trigger, Memory Postgres Chat, OpenAI Embeddings +16