Integrate Supabase Vector Database with n8n for RAG Workflows
detail.loadingPreview
This n8n workflow demonstrates how to ingest, embed, and retrieve data from a Supabase Vector Database for Retrieval Augmented Generation (RAG) applications. It covers preparing your Supabase instance, inserting documents, and setting up a Q&A chain.
🚀Ready to Deploy This Workflow?
About This Workflow
Overview
This n8n workflow provides a comprehensive solution for integrating a Supabase Vector Database with your n8n automation, specifically for building Retrieval Augmented Generation (RAG) systems. It guides you through the necessary preparation steps in Supabase, including enabling the pgvector extension, creating or altering tables with embedding, metadata, and content columns, setting up appropriate policies, and defining a custom match_documents function for efficient retrieval. The workflow then handles the ingestion of data, using the Google Drive node to fetch files, the Default Data Loader and Recursive Character Text Splitter for processing, and Embeddings OpenAI to generate vector embeddings before inserting them into your Supabase table via the Insert Documents node. Finally, it sets up a retrieval and question-answering chain using When chat message received trigger, Vector Store Retriever, OpenAI Chat Model, and Question and Answer Chain nodes, allowing users to query the ingested data.
Key Features
- Seamlessly integrates with Supabase Vector Database.
- Supports data ingestion from Google Drive.
- Utilizes OpenAI for embedding generation.
- Enables RAG for question answering.
- Includes detailed preparation steps for Supabase.
- Handles data loading, splitting, embedding, and insertion.
How To Use
- Prepare Supabase:
- Enable the
pgvectorextension. - Create or alter your table to include
embedding(VECTOR with appropriate dimensions),metadata(JSONB), andcontent(TEXT) columns. - Set up appropriate authentication policies.
- Create the
match_documentscustom function in your Supabase SQL editor.
- Enable the
- Configure Nodes:
- Update the
Google Drivenode with your file ID. - Configure the
Default Data Loaderwith the correct loader and data type. - Ensure the
Embeddings OpenAI InsertionandEmbeddings OpenAI Retrievalnodes use consistent embedding models. - Set the correct
tableNamein theInsert DocumentsandRetrieve by Querynodes. - Configure the
OpenAI Chat Modelwith your API key and desired settings.
- Update the
- Set up Trigger:
- Configure the
When chat message receivednode with your webhook settings and initial greeting.
- Configure the
- Connect Nodes:
- Chain the nodes logically: Data fetching -> Text splitting -> Embedding -> Insertion -> Retrieval -> Question Answering.
- Test:
- Trigger the workflow by sending a chat message to the webhook URL and observe the Q&A process.
Apps Used
Workflow JSON
{
"id": "5448af4c-f203-4011-8693-d30b187e0559",
"name": "Integrate Supabase Vector Database with n8n for RAG Workflows",
"nodes": 0,
"category": "Database & Storage",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 5448af4c-f203...
About the Author
DevOps_Master_X
Infrastructure Expert
Specializing in CI/CD pipelines, Docker, and Kubernetes automations.
Statistics
Verification Info
Related Workflows
Discover more workflows you might like
AI-Powered SQL Query Generation From Database Schema Only
Automate SQL query generation based solely on your database schema using AI. This workflow leverages the OpenAI Chat Model and LangChain agents to create SQL queries from schema information, without needing direct access to the data itself.
Chat with Your PostgreSQL Database Using an AI Agent
Seamlessly query your PostgreSQL database using natural language. This workflow leverages an AI Agent to understand user requests, generate SQL queries, and retrieve data, making database interaction accessible to everyone.