Templates / Build a local RAG chatbot with Ollama, Qwen, BGE-M3 and Postgres PGVector

Build a local RAG chatbot with Ollama, Qwen, BGE-M3 and Postgres PGVector

Ready for 3.0

by Wassim Abid · 688 views · created 2026-04-06 · Internal Wiki, AI RAG

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What 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.

  1. Understand Request (Basic LLM Chain): sends a prompt to an LLM, with model: Ollama Chat Model
  2. JSON Formatter (Code): runs custom JavaScript code
  3. Switch: routes items into 2 branches
  4. Small Talk AI Agent (AI Agent): runs an AI agent, with model: Ollama Chat Model; memory: Postgres Chat Memory
  5. Split Sub-Queries (Split Out): splits a list into separate items
  6. Remove Think Tags (Small Talk Path) (Code): runs custom JavaScript code
  7. Loop Over Sub-Queries (Loop Over Items (Split in Batches)): loops over the items in batches
  8. Respond to Webhook: sends the response back to the webhook caller
  9. Aggregate: combines items into one
  10. 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

Postgres Chat MemoryOllama Chat ModelEmbeddings OllamaPostgres PGVector Store

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)

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…

Excerpt from Wassim Abid's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.