Automate RAG knowledge base creation using this powerful n8n workflow. Ingest files from Google Drive, create OpenAI embeddings, and store them in Supabase Vector Store.
Download this n8n workflow template and start using it instantly.
Developers building internal knowledge bases using RAG architecture.
Data engineers needing reliable, automated file ingestion pipelines.
Businesses requiring up-to-date document indexing without manual intervention.
Users looking for advanced n8n templates integrating cloud storage, databases, and AI.
Managing a scalable Retrieval-Augmented Generation (RAG) system requires a robust data ingestion pipeline. This comprehensive n8n workflow addresses the challenge of keeping your knowledge base current by automatically monitoring a Google Drive folder. Every new file or update detected by the n8n trigger is downloaded, validated against duplicates, extracted based on file type (PDF, DOCX, CSV, etc.), summarized, embedded using OpenAI, and finally indexed in a Supabase Vector Store. This advanced n8n node combination ensures that your AI agents always have access to the latest, relevant information. By utilizing this detailed n8n workflow, you minimize manual overhead and maximize data freshness for your AI applications.
This complex n8n workflow operates in two main phases: Ingestion and Querying.
1. Ingestion (Triggered by Google Drive):
The process starts with two specialized n8n triggers: File Created or Update to File in Google Drive.
The Loop Over Items node processes files one by one, setting the necessary file metadata (Set File ID).
The Validate File node checks file types and structure before proceeding.
A crucial step is Check for Duplicates (Postgres node). If a file with the same ID already exists, the n8n workflow logs the duplicate (Log Duplicate) and sends a notification (Slack Duplicate Notification).
If the file is new or updated, the n8n workflow uses Supabase nodes (Delete old Doc, Delete Old Data Rows) to clean up previous versions, ensuring data integrity. It then logs debug data using a Set n8n node.
The Download File node pulls the content from Google Drive.
The Switch n8n node routes the file based on its mime type (e.g., PDF, TXT, CSV) to the appropriate content extraction n8n node.
Content is aggregated, summarized (Summarize), and prepared for vectorization.
The LangChain components take over: The content is chunked (Character Text Splitter), loaded (Default Data Loader), and transformed into vectors using the Embeddings OpenAI n8n node.
Finally, the vectors are persisted in the Supabase Vector Store n8n node, completing the RAG index update.
2. Querying (AI Agent Interaction):
A separate path is initiated by the When chat message received n8n trigger (LangChain Chat Trigger).
The RAG AI Agent node orchestrates the query, utilizing the OpenAI Chat Model (LLM), Postgres Chat Memory (to maintain conversation context), and specialized database tools (List Documents, Query Document Rows, Get Full Document Text) to retrieve relevant information from the Supabase RAG index, ensuring accurate responses based on the ingested documents. This query path demonstrates the power of the end-to-end n8n workflow setup.
File Created and Update to File n8n trigger nodes, ensuring n8n has access to the target folder.Check for Duplicates, Insert Metadata, Supabase Vector Store). You will need the connection details for your metadata and vector tables.Embeddings OpenAI n8n node and the OpenAI Chat Model within the RAG Agent. This is essential for the AI part of the n8n templates.Slack Duplicate Notification and Error Notification nodes with valid Gmail or Slack credentials if you wish to receive alerts. Google Drive Trigger (File Created / Update to File): These are the core n8n trigger nodes that start the ingestion process when a file event occurs in the monitored folder.
Postgres n8n node (Check for Duplicates): Queries the metadata table to determine if the document ID already exists, preventing redundant processing within this n8n workflow.
Google Drive n8n node (Download File): Fetches the actual binary content of the file from Google Drive, required before extraction.
Switch n8n node: A flow control node that routes the file data based on MIME type to the correct content extraction n8n node (e.g., PDF, TXT, CSV, DOCX).
Extract from File n8n node (Multiple Instances): Specialized n8n nodes for parsing content out of binary files (like Extract from File PDF, Extract from TXT).
Embeddings OpenAI n8n node: Generates high-quality vector embeddings using the OpenAI API for the document chunks.
Supabase Vector Store n8n node: The final step in the ingestion pipeline. This n8n node handles inserting the embeddings into the configured Supabase (pgvector) database.
Chat Trigger n8n trigger (When chat message received): Initiates the interactive AI query path of the n8n workflow, allowing users to communicate with the knowledge base.
OpenAI Chat Model), chat history (Postgres Chat Memory), and the Supabase Vector Store2 tool for effective RAG functionality.Automate self-maintenance for your n8n instance using AI-driven filtering, secure webhooks, and the n8n API. Manage security audits, backups, and scheduled pauses.

Deploy this advanced n8n workflow to automatically refine complex research questions, execute web queries via Brave Search, and semantically re-rank results using Google Gemini AI. Find this and more n8n templates.

Build an intelligent Brave Search AI agent using n8n workflow technology. This n8n template uses Gemini and the Multi-Agent Collaboration Protocol (MCP) to orchestrate dynamic web and local search queries.

Automate recruitment customer service using this interactive WhatsApp bot n8n workflow. Integrates Google Sheets for CRM, handles media files, tracks requests, and manages complaints.

Use this dynamic n8n workflow to create an interactive Russian language tutor bot on Telegram powered by GPT-4o. Learn vocabulary, grammar, or take quizzes instantly using specific tags.









































