Build a local RAG chatbot with Ollama, Qwen, BGE-M3 and Postgres PGVector
Ready for 3.0What this workflow does
This AI workflow has 25 nodes and runs when an HTTP POST request hits its webhook URL. Along the way it connects Postgres Chat Memory, Ollama Chat Model, Embeddings Ollama and Postgres PGVector Store.
How it runs
Trigger: When an HTTP POST request hits its webhook URL.
- Understand Request (Basic LLM Chain): sends a prompt to an LLM, with model: Ollama Chat Model
- JSON Formatter (Code): runs custom JavaScript code
- Switch: routes items into 2 branches
- Small Talk AI Agent (AI Agent): runs an AI agent, with model: Ollama Chat Model; memory: Postgres Chat Memory
- Split Sub-Queries (Split Out): splits a list into separate items
- Remove Think Tags (Small Talk Path) (Code): runs custom JavaScript code
- Loop Over Sub-Queries (Loop Over Items (Split in Batches)): loops over the items in batches
- Respond to Webhook: sends the response back to the webhook caller
- Aggregate: combines items into one
- PGVector Store — Retrieve Chunks (Postgres PGVector Store): searches the Postgres PGVector Store vector store, with embeddings: Ollama Embeddings (BGE-M3)
…plus 8 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (16)
- Split Out
n8n-nodes-base.splitOut - Aggregate
n8n-nodes-base.aggregate - If
n8n-nodes-base.if - Edit Fields (Set)
n8n-nodes-base.set - Filter
n8n-nodes-base.filter - Postgres Chat Memory
@n8n/n8n-nodes-langchain.memoryPostgresChat - Code
n8n-nodes-base.code - Switch
n8n-nodes-base.switch - AI Agent
@n8n/n8n-nodes-langchain.agent - Ollama Chat Model
@n8n/n8n-nodes-langchain.lmChatOllama - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Embeddings Ollama
@n8n/n8n-nodes-langchain.embeddingsOllama - Postgres PGVector Store
@n8n/n8n-nodes-langchain.vectorStorePGVector - Webhook
n8n-nodes-base.webhook - Respond to Webhook
n8n-nodes-base.respondToWebhook - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm
From the author
Build a fully local RAG chatbot using Ollama that works without tool calling — ideal for smaller open-source models like Qwen that don't support native function calls. This template lets you run a private, self-hosted AI assistant with retrieval-augmented…