🎯 Learning Objectives
Understand what embeddings are and why they’re useful for automation.
Learn how to store and search text data in a vector database.
Build an embedding pipeline using n8n, Supabase, and Gemini embeddings.
Query your knowledge base through an AI Agent.
1. What Are Embeddings?
Think of embeddings as numbers that capture the meaning of text.
Example: “car”, “automobile”, “vehicle” → embeddings of these words will be close to each other in a 3D space.
These embeddings are stored in a vector database, so when you search, the system finds the “closest meaning” instead of exact words.
This is how AI can answer questions even if your query wording doesn’t exactly match your documents.
👉 Analogy: Imagine a library where books are sorted by topic similarity, not alphabet. When you ask about “cars,” you’ll also get “automobile” books.
2. Setting Up the Vector Database in Supabase
Supabase supports pgvector, which allows you to store embeddings.
Here’s a sample SQL schema you can run inside Supabase:
👉 Note: Gemini embeddings use 3027 dimensions, so we define the vector size accordingly.
3. Creating the Embedding Workflow in n8n
We’ll now build a workflow that:
Starts manually
Downloads your text file from Google Drive
Embeds the text with Gemini embeddings
Stores the embedding into Supabase
Workflow: Manual Trigger → Google Drive → Supabase
Manual Trigger – start the workflow by hand.
Google Drive Node – download your text file.
Gemini Embeddings Node (via n8n OpenAI/Gemini connector) – convert text into vectors.
Supabase Vector Node – insert into the documents table.
4. Querying the Vector Database with an AI Agent
Now let’s make it interactive:
Chat Trigger Node – user can type a question.
AI Agent Node – configured with Supabase vector store as a tool.
The agent first checks Supabase for the most relevant chunks of text.
Then it uses those chunks as context to answer the user’s query.
👉 Example:
User asks: “What services does the website offer?”
The AI Agent searches the Supabase embeddings, finds the relevant website section, and answers naturally.
✅ Key Takeaways
Embeddings = numerical meaning of text.
Vector database = store + search by similarity, not exact words.
Supabase with pgvector lets us easily integrate embeddings into workflows.
With n8n, you can automate both embedding creation and query answering.