Build an advanced multi-query RAG system with Supabase and GPT-5
Ready for 3.0What this workflow does
This AI workflow has 18 nodes and runs when a chat message arrives (plus 1 other trigger). Along the way it connects OpenAI Chat Model, Supabase Vector Store and Embeddings OpenAI.
How it runs
Trigger: When a chat message arrives (plus 1 other trigger).
- AI Agent: runs an AI agent, with model: OpenAI Chat Model; 2 tools (Think, Query knowledge base); memory: Simple Memory
- Split Out: splits a list into separate items
- Loop Over Items (Loop Over Items (Split in Batches)): loops over the items in batches
- Aggregate: combines items into one
- Supabase Vector Store: searches the Supabase vector store, with embeddings: Embeddings OpenAI
- Clean RAG output (Edit Fields (Set)): sets 1 field: Chunk content
- Keep score over 0. (Filter): keeps only the items that match a condition
- Any chunk? (If): checks a condition and branches into true / false
- Aggregate: combines items into one
- Say no chunk match (Edit Fields (Set)): sets 1 field: Retrieval output
…plus 1 more step. See the full node list below.
Services it uses
Other OpenAI + Supabase templates (149)
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 (15)
- AI Agent
@n8n/n8n-nodes-langchain.agent - Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - Split Out
n8n-nodes-base.splitOut - Aggregate
n8n-nodes-base.aggregate - If
n8n-nodes-base.if - Edit Fields (Set)
n8n-nodes-base.set - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Execute Workflow Trigger
n8n-nodes-base.executeWorkflowTrigger - Call n8n Workflow Tool
@n8n/n8n-nodes-langchain.toolWorkflow - Supabase Vector Store
@n8n/n8n-nodes-langchain.vectorStoreSupabase - Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi - Think Tool
@n8n/n8n-nodes-langchain.toolThink - Filter
n8n-nodes-base.filter
From the author
Go beyond basic Retrieval-Augmented Generation (RAG) with this advanced template. While a simple RAG setup can answer straightforward questions, it often fails when faced with complex queries and can be polluted by irrelevant information. This workflow…