Two-stage document retrieval chatbot with OpenAI and Supabase vector search
Ready for 3.0What this workflow does
This AI workflow has 11 nodes and runs when a chat message arrives (plus 1 other trigger). Along the way it connects OpenAI and Supabase.
How it runs
Trigger: When a chat message arrives (plus 1 other trigger).
- Find Files (Code): runs custom JavaScript code
- GetFile (Supabase): get many
- Filter: keeps only the items that match a condition
- OpenAI CreateEmbeddings (HTTP Request): calls an HTTP API (POST)
- Aggregate: combines items into one
- UpdateEmbedding (Supabase): update
- OpenAI: uses OpenAI, with 1 tool (Database retrieval)
- Set Output (Edit Fields (Set)): sets 1 field: output
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 (10)
- Code Tool
@n8n/n8n-nodes-langchain.toolCode - Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger - OpenAI
@n8n/n8n-nodes-langchain.openAi - Supabase
n8n-nodes-base.supabase - HTTP Request
n8n-nodes-base.httpRequest - Manual Trigger
n8n-nodes-base.manualTrigger - Code
n8n-nodes-base.code - Filter
n8n-nodes-base.filter - Aggregate
n8n-nodes-base.aggregate - Edit Fields (Set)
n8n-nodes-base.set
From the author
Video Guide I prepared a comprehensive guide demonstrating how to build a multi-level retrieval AI agent in n8n that smartly narrows down search results first by file descriptions, then retrieves detailed vector data for improved relevance and answer quality.…