Templates / Two-stage document retrieval chatbot with OpenAI and Supabase vector search

Two-stage document retrieval chatbot with OpenAI and Supabase vector search

Ready for 3.0

by Mark Shcherbakov ✓ · 1,413 views · created 2025-06-28 · 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 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).

  1. Find Files (Code): runs custom JavaScript code
  2. GetFile (Supabase): get many
  3. Filter: keeps only the items that match a condition
  4. OpenAI CreateEmbeddings (HTTP Request): calls an HTTP API (POST)
  5. Aggregate: combines items into one
  6. UpdateEmbedding (Supabase): update
  7. OpenAI: uses OpenAI, with 1 tool (Database retrieval)
  8. Set Output (Edit Fields (Set)): sets 1 field: output

Services it uses

OpenAISupabase

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)

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

Excerpt from Mark Shcherbakov'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.