Keep RAG System Updated with Google Drive File Changes to Supabase Vector DB
This n8n workflow ensures data freshness in the RAG system by handling modifications to existing files. It complements the "Document Ingestion" workflow by triggering whenever a file in the monitored Google Drive folder is updated.
This "delete-then-re-insert" process ensures the RAG agent always has access to the most current version of your documents.
Key Features & Workflow:
Update Trigger: The workflow activates using the File Updated trigger for the same Google Drive folder ("DOCUMENTS").
Duplicate Run Prevention: An If node cleverly filters out immediate "update" events that are triggered by the "Upload Doc" workflow's Word-to-Google-Doc conversion, preventing unecessary duplicate runs.
Delete Old Entries: Once a genuine update is detected, the workflow's first action is to find and delete all existing vector chunks associated with that file_id from the Supabase "documents" table.
Smart Versioning: It then retrieves the old version number from the deleted metadata and uses an OpenAI node (Set Version) to intelligently increment it (e.g., "v1" becomes "v2").
Re-Ingestion Pipeline: The updated file is then processed through the exact same logic as the "Upload Doc" workflow:
It is routed by a Switch node based on its MIME type (PDF, Google Doc, Excel, etc.).
Text is extracted, chunked, and embedded.
The Enhanced Default Data Loader enriches these new chunks with metadata, including the new, incremented version number.
Insert New Entries: Finally, the newly processed and versioned chunks are inserted back into the Supabase Vector Store.
Related Templates
Automate Daily Keyword Research with Google Sheets, Suggest API & Custom Search
Who's it for This workflow is perfect for SEO specialists, marketers, bloggers, and content creators who want to automa...
USDT And TRC20 Wallet Tracker API Workflow for n8n
Overview This n8n workflow is specifically designed to monitor USDT TRC20 transactions within a specified wallet. It u...
Add product ideas to Google Sheets via a Slack
Use Case This workflow is a slight variation of a workflow we're using at n8n. In most companies, employees have a lot o...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments