Library / RAG & Knowledge Bases
RAG & Knowledge Bases
Seed a Supabase vector knowledge base from Notion using Ollama embeddings
Run manually to read Notion pages, create embeddings with a local Ollama model, and store them in a Supabase pgvector table for retrieval.
What it does
## Prerequisites ### 1. Notion: create an integration - Go to https://www.notion.so/my-integrations - Click "New integration" and give it a name - Copy the Internal Integration Token (you will need it in Step 4) - In your Notion database, click Share → Invite your integration ### 2. Supabase: enable pgvector and create the table In your Supabase project, open the SQL Editor from the left sidebar and run: sql create extension if not exists vector; create table documents ( id bigserial primary key, content text, metadata jsonb, embedding vector(768) ); create or replace function match_documents ( query_embedding vector(768), match_count int default 5, filter jsonb default '{}' ) returns table ( id bigint, content text, metadata jsonb, similarity float ) language plpgsql as $$ begin return query select documents.id, documents.content, documents.metadata, 1 - (documents.embedding query_embedding) as similarity from documents where documents.metadata @> filter order by documents.embedding query_embedding limit match_count; end; $$; ### 3. Ollama: running locally - Install Ollama: https://ollama.com - Pull the embedding model: ollama pull nomic-embed-text - Make sure Ollama is running before executing this workflow ### 4. Add credentials in n8n In n8n, go to Settings → Credentials → Add Credential and create: Notion API (type: Notion API): - Internal Integration Token → paste the token copied in Step 1 Supabase (type: Supabase): - Host URL → Supabase Dashboard → Settings → API → Project URL - Service Role Secret → same page, under "Project API keys" → service_role Ollama (type: Ollama): - Base URL → http://localhost:11434 ### 5. Connect credentials to nodes Open each node that shows a credential warning and select the matching credential from the dropdown. ### 6. Configure the Remove Existing Embeddings node Open the Remove Existing Embeddings node and replace YOUR_SUPABASE_PROJECT_URL with your Supabase project URL (found in Supabase Dashboard → Settings → API → Project URL). Select your Supabase credential from the dropdown. This node runs at the start of every execution and clears all documents from the knowledge base before re-inserting fresh content, so re-running the workflow never creates duplicates.
The steps
- Start Notion Ingestion
- Get Notion Pages
- Fetch Page Blocks
- Aggregate Block Text
- Insert into Knowledge Store
- Generate Embeddings Ollama
- Load Default Data
- Split Text for Processing
- Schedule Sync
- Skip Empty Pages
- Remove Existing Embeddings
Similar automations
RAG & Knowledge BasesChat with local documents using Ollama and MariaDB Vector cache28 stepsRAG & Knowledge BasesStore Notion Pages as Vector Documents in Supabase10 stepsRAG & Knowledge BasesEmbed New Notion Pages with OpenAI into a Supabase Vector Store9 stepsRAG & Knowledge BasesAutonomous AI Customer Support Agent with Multi-KB RAG & Human Escalation50 steps