Upsert huge documents in a vector store with Supabase and Notion
Ready for 3.0What 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).
- Get updated pages (Notion): get many (database page)
- Question and Answer Chain: answers questions over your documents (RAG), with model: OpenAI Chat Model; retriever: Vector Store Retriever
- Loop Over Items (Loop Over Items (Split in Batches)): loops over the items in batches
- Delete old embeddings if exist (Supabase): delete
- Limit: keeps the first few items
- Get page blocks (Notion): get many (block)
- Concatenate to single string (Summarize): summarizes / groups the items
- Supabase Vector Store: stores documents in the Supabase vector store, with embeddings: Embeddings OpenAI; document loader: Default Data Loader
- Limit: keeps the first few items
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 (16)
- Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi - Token Splitter
@n8n/n8n-nodes-langchain.textSplitterTokenSplitter - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Question and Answer Chain
@n8n/n8n-nodes-langchain.chainRetrievalQa - Vector Store Retriever
@n8n/n8n-nodes-langchain.retrieverVectorStore - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger - Schedule Trigger
n8n-nodes-base.scheduleTrigger - Limit
n8n-nodes-base.limit - Supabase
n8n-nodes-base.supabase - Notion
n8n-nodes-base.notion - Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - No Operation, do nothing
n8n-nodes-base.noOp - Notion Trigger
n8n-nodes-base.notionTrigger - Supabase Vector Store
@n8n/n8n-nodes-langchain.vectorStoreSupabase - Summarize
n8n-nodes-base.summarize
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,…