- Home
- Skills
- Workflow Automation
- n8n supabase rag agent
n8n supabase rag agent
by Nada Ahmed
Configure and troubleshoot n8n RAG workflows with Supabase pgvector, Google Gemini, and OpenRouter.
Free
n8n supabase rag agent
Example session with this skill installed
I'm getting a dimension mismatch error in Supabase when trying to ingest docs using Gemini embeddings. How do I fix the SQL table?
- Read your context and instructions
- Compiled the n8n supabase rag
The error occurs because the Google Gemini embedding model generates 3072-dimensional vectors, but your Supabase documents table is likely still using the default 1536 dimensions.
Supabase Vector Table Alignment
To resolve this, you must update the table schema and the matching function to accept 3072-dimensional vectors. Run the following SQL in your Supabase SQL Editor:
-- 1. Alter the embedding column to match Gemini 3072 dimensions
ALTER TABLE documents
ALTER COLUMN embedding TYPE vector(3072);
-- 2. Drop the existing match function to allow recreation
DROP FUNCTION IF EXISTS match_documents;
-- 3. Recreate the function with the correct vector dimensions
CREATE OR REPLACE FUNCTION match_documents (
query_embedding vector(3072),
match_threshold float,
match_count int,
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)
AND 1 - (documents.embedding <=> query_embedding) > match_threshold
ORDER BY similarity DESC
LIMIT match_count;
END;
$$;
Next steps
- Clear existing rows: If you had 1536-dimension data, delete it before re-ingesting.
- Restart Ingestion: Run the n8n Google Drive ingestion workflow for one file to verify the insert.
- Verify Retrieval: Test the Chat workflow to ensure the
match_documentscall succeeds.
Connects securely to your tools. The creator never sees your data.
About this skill
Building a reliable RAG system often fails at the seams: mismatched embedding dimensions, broken ingestion pipelines, or hallucinations when retrieval returns empty results. This skill provides the direct technical guidance needed to configure and maintain a production-ready n8n RAG agent using Supabase and Google Gemini.
What it does
- Workflow configuration provides step-by-step setup for n8n ingestion and chat retrieval exports.
- Database synchronization ensures Supabase
documentstables andmatch_documentsfunctions match embedding dimensions. - Ingestion management handles Google Drive triggers, text chunking, and metadata-aware vector inserts.
- Response grounding optimizes AI Agent system instructions to cite sources and prevent hallucinations.
- Troubleshooting diagnoses common failures in embedding generation, vector retrieval, and chat memory.
How it works
- Environment audit identifies your n8n version and verifies credentials for Supabase, Gemini, and OpenRouter.
- Ingestion setup configures the pipeline from Google Drive through the Recursive Character Text Splitter to Supabase.
- Retrieval tuning connects the AI Agent to the vector store tool and configures Postgres Chat Memory context.
- Validation runs a multi-step test from single-document ingestion to out-of-scope query handling.
Frameworks & tools
This skill is built for n8n workflows utilizing Supabase (pgvector), Google Gemini (embeddings), OpenRouter (LLMs), Google Drive, and PostgreSQL.
Why this beats prompting it yourself
Generic prompts often ignore the specific architectural requirements of n8n node inputs or pgvector function signatures. This skill uses the provided project exports as a source of truth to ensure metadata filters and embedding dimensions are technically aligned.
Use cases
- Deploy a document Q&A bot that pulls live data from a Google Drive folder.
- Fix embedding-dimension errors when switching between different Gemini models.
- Set up automated document updates that clear old vector rows before re-indexing.
- Implement metadata filtering to isolate chat retrieval to specific files or projects.
Known limitations
Does not support file types incompatible with the n8n Extract from File node. Requires manual credential setup within the n8n UI as it cannot handle sensitive API keys.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 10 days ago
- Free with an Agensi account
Permissions
What's inside
Frequently Asked Questions
New in Workflow Automation
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Workflow Automation.