Templates / Upsert huge documents in a vector store with Supabase and Notion

Upsert huge documents in a vector store with Supabase and Notion

Ready for 3.0

by Mario ✓ · 14,248 views · created 2024-11-24 · 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 19 nodes and runs on a schedule (every minute) (plus 2 other triggers). Along the way it connects Embeddings OpenAI, OpenAI Chat Model, Supabase and Notion and 1 more.

How it runs

Trigger: On a schedule (every minute) (plus 2 other triggers).

  1. Get updated pages (Notion): get many (database page)
  2. Question and Answer Chain: answers questions over your documents (RAG), with model: OpenAI Chat Model; retriever: Vector Store Retriever
  3. Loop Over Items (Loop Over Items (Split in Batches)): loops over the items in batches
  4. Delete old embeddings if exist (Supabase): delete
  5. Limit: keeps the first few items
  6. Get page blocks (Notion): get many (block)
  7. Concatenate to single string (Summarize): summarizes / groups the items
  8. Supabase Vector Store: stores documents in the Supabase vector store, with embeddings: Embeddings OpenAI; document loader: Default Data Loader
  9. Limit: keeps the first few items

Services it uses

Embeddings OpenAIOpenAI Chat ModelSupabaseNotionSupabase Vector 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

Purpose This workflow adds the capability to build a RAG on living data. In this case Notion is used as a Knowledge Base. Whenever a page is updated, the embeddings get upserted in a Supabase Vector Store. It can also be fairly easily adapted to PGVector,…

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