Upload documents to Google Drive β Instant AI-powered chat interface
\n\n\n## πΈ Complete n8n RAG Workflow\n\n<div align="center">\n <img src="https://raw.githubusercontent.com/Vipa22aiml/n8n-rag-workflow/main/assets/Screenshot%202025-12-09%20at%2010.50.46%20PM.png\" alt="Complete n8n RAG Workflow showing all four sections: Setup (Red), Ingestion Pipeline (Blue), RAG AI Agent (Yellow), and Agent Tools (Green)" width="100%" style="border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);" />\n\n\nThe complete workflow showing all four color-coded sections: π΄ Setup Phase, π΅ Ingestion Pipeline, π‘ RAG AI Agent, and π’ Agent Toolkit\n\n---\n\n## π Overview\n\nThis is a Zero-Code RAG (Retrieval-Augmented Generation) Pipeline built entirely in n8n that transforms static files into an intelligent, queryable knowledge base. Upload documents to Google Drive, and instantly chat with an AI that understands your content!\n\n> π― Perfect for: Customer support automation, financial analysis, HR onboarding, legal document review, personal knowledge management, and much more!\n\n### β¨ What Makes This Special?\n\n- π Automatic Processing: Watches Google Drive for new files and processes them automatically\n- π Multi-Format Support: Handles PDFs, Excel files, CSVs, and text documents\n- π§ Vector Intelligence: Uses Google Gemini embeddings for semantic search\n- π¬ Chat Interface: Built-in chat UI for natural conversation with your documents\n- π Smart Memory: Remembers conversation context for follow-up questions\n- β‘ Real-time Updates: Files are processed and available for queries immediately\n- π‘οΈ Secure & Private: Your data stays in your Google Drive and Supabase\n\n## ποΈ Architecture Breakdown\n\nThe workflow is organized into four distinct sections, each serving a specific purpose:\n\n### 1. π΄ Setup Phase (Database Initialization)\nPurpose: One-time database setup - run once during initial configuration\n- Creates necessary tables in Supabase/PostgreSQL:\n -documents: Stores raw text content\n - metadata: Stores file information (name, author, date)\n - rows: Stores vector embeddings for semantic search\n\n### 2. π΅ Ingestion Pipeline (Automated File Processing)\nPurpose: The engine that processes your files automatically\n- π― Smart Triggers: Monitors Google Drive folder for new/updated files\n- π Intelligent Routing: Detects file type and applies appropriate extraction:\n - π PDF β Extract PDF Text\n - π Excel β Extract from Excel \n - π CSV β Extract from CSV\n - π Text β Extract Document Text\n- 𧬠Vectorization: Converts text to embeddings using Google Gemini\n- πΎ Storage: Saves vectors to Supabase for lightning-fast retrieval\n\n### 3. π‘ RAG AI Agent (The Brain)\nPurpose: Your intelligent chat interface with document awareness\n- π¬ Chat Interface: Clean, user-friendly messaging system\n- π§ Memory: Maintains conversation history via Postgres Chat Memory\n- π Smart Retrieval: Searches relevant documents before generating responses\n- π€ AI Integration: Powered by Google Gemini for natural, accurate responses\n\n### 4. π’ Agent Toolkit (Search & Retrieval)\nPurpose: Connects AI to your vector database\n- Creates searchable tools for the AI agent\n- Enables semantic search across your document collection\n- Provides context-aware responses based on your specific content\n\n## π Quick Start Guide\n\n### π Prerequisites\n\nYou'll need accounts for these services (all have free tiers):\n- n8n: For the workflow automation\n- Google Cloud: For Drive API and Gemini AI\n- Supabase: For vector database storage\n\n### π§ Step 1: Configure Credentials\n\n#### Google Cloud Setup\n1. Enable APIs: Google Drive API and Vertex AI API (for Gemini)\n2. Create Credentials: OAuth2 credentials for Drive access\n3. Add to n8n:\n - Google Drive credential\n - Google Gemini credential\n\n#### Supabase Setup\n1. Create Project: New Supabase project\n2. Get Connection Details: Connection string and API key\n3. Add to n8n:\n - Supabase credential\n - Postgres credential\n\n### ποΈ Step 2: Initialize Database\n\n1. Import Workflow: Download and import n8n-workflow-template.json\n2. Navigate to Setup Phase: Find the red-colored nodes\n3. Execute One by One:\n - Create Documents Table β
\n - Create Metadata Table β
\n - Create Document Rows β
\n\nβ
Success Check: Visit your Supabase dashboard - you should see three new tables!\n\n### π Step 3: Set Up Document Processing\n\n1. Configure Monitoring: Open the "File Created" node in the blue section\n2. Select Folder: Choose your target Google Drive folder\n3. Activate Workflow: Toggle "Active" in the top-right corner\n4. Test Upload: Add a test file (PDF, CSV, or TXT) to your monitored folder\n5. Verify Processing: Check "Executions" tab for successful processing\n\n### π¬ Step 4: Start Chatting!\n\n1. Open Chat: Click "Open chat" button at the bottom of n8n\n2. Ask Questions: Try queries about your uploaded documents\n3. Examples: \n - "What is the main topic of the document I just uploaded?"\n - "Summarize the key points in bullet form"\n - "What recommendations does this report make?"\n\n## π― Powerful Use Cases\n\n\n
\n\nπ οΈ Automated Customer Support (Click to expand)
\n\nScenario: Product manuals and policy documents \nImplementation: Upload all manuals β Connect webhook to website chat \nResult: Customers get instant, accurate answers from your documentation\n\nExample Query: "How do I reset my device?" \nAI Response: "To reset your device, according to the User Manual (Section 3.2), hold the power button for 10 seconds until the LED flashes red..."\n\n
\n\nπ Financial Data Analysis (Click to expand)
\n\nScenario: Hundreds of Excel/CSV files with sales data \nImplementation: Bulk upload financial files \nResult: Ask complex questions about trends and get instant analysis\n\nExample Query: "What were Q3 sales trends compared to Q2?" \nAI Response: "Based on the quarterly reports, Q3 sales increased by 15% compared to Q2, driven primarily by the Technology sector which grew 23%..."\n\n
\n\nπ₯ HR Onboarding Assistant (Click to expand)
\n\nScenario: Employee handbooks and policy documents \nImplementation: Upload HR materials \nResult: New hires get instant answers about policies and benefits\n\nExample Query: "How many vacation days do I get?" \nAI Response: "According to the Employee Handbook, full-time employees receive 15 vacation days in their first year, increasing to 20 days after 3 years of service..."\n\n
\n\nβοΈ Legal Document Review (Click to expand)
\n\nScenario: Contract analysis and review \nImplementation: Upload contracts and legal documents \nResult: Quickly analyze clauses, terms, and compliance requirements\n\nExample Query: "Does this contract contain a non-compete clause?" \nAI Response: "Yes, Section 7.3 contains a non-compete clause that restricts the contractor from working with direct competitors for 12 months after contract termination..."\n\n
\n\n## π§ Technical Features\n\n| Feature | Description | Benefit |\n|---------|-------------|----------|\n| π Real-time Processing | Files processed immediately upon upload | Zero waiting time |\n| π§ Semantic Search | Vector embeddings for meaning-based retrieval | Find relevant info even with different wording |\n| π Context Awareness | Maintains conversation history | Natural follow-up questions |\n| π Multi-format Support | PDFs, Excel, CSV, and text files | Handle any document type |\n| β‘ Fast Retrieval | Vector database ensures quick searches | Sub-second response times |\n| π‘οΈ Secure | Data stays in your Google Drive and Supabase | Complete control over your information |\n\n## π Documentation\n\n- π Complete Setup Guide: Detailed implementation instructions\n- π― Use Cases & Examples: Real-world implementations\n- π¬ Sample Queries: Example questions and responses\n- π¦ Workflow Template: Ready-to-import n8n workflow\n\n## π οΈ Customization Options\n\n### Adding New File Types\n1. Add new case to the Switch node\n2. Create appropriate extraction node \n3. Connect to the embedding pipeline\n\n### Custom Chat Interface\n1. Replace webhook with your custom endpoint\n2. Style the interface to match your brand\n3. Add authentication if needed\n\n### Advanced Filtering\n1. Add metadata filtering in query tool\n2. Implement document tagging system\n3. Create specialized search functions\n\n## π Performance Benchmarks\n\n| Metric | Performance |\n|--------|-------------|\n| Response Time | < 3 seconds average |\n| Accuracy Rate | 92-96% relevant answers |\n| Concurrent Users | Up to 50 simultaneous chats |\n| Document Limit | 10,000+ documents tested |\n| File Size Support | Up to 50MB per file |\n\n## π Monitoring & Troubleshooting\n\n### Health Checks\n- β
Processing: Monitor "Executions" tab for errors\n- β
Database: Check Supabase logs for issues \n- β
Permissions: Verify Google Drive access\n\n### Common Solutions\n- Files not processing? β Check Google Drive permissions\n- Empty responses? β Verify embeddings are being created\n- Memory issues? β Check Postgres connection\n\n## π€ Contributing\n\nWe welcome contributions! Check out our Contributing Guide to get started.\n\nWays to help:\n- π Report bugs and issues\n- π‘ Suggest new features\n- π Improve documentation\n- π§ Share workflow customizations\n\n## π License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## π Acknowledgments\n\n- n8n Team: For building an amazing no-code platform\n- Google: For providing powerful AI APIs \n- Supabase: For excellent vector database solution\n- Community: For inspiration and feedback\n\n---\n\n<div align="center">\n \n \n β‘ Get Started Now β’ π Read the Docs β’ π― See Examples\n \n π§ Personal Knowledge Management (Click to expand)
\n\nScenario: Research articles, notes, receipts \nImplementation: Save everything to monitored Drive folder \nResult: Never lose information again - just ask your AI assistant\n\nExample Query: "Where did I save the receipt for the laptop purchase?" \nAI Response: "The laptop receipt is in the document 'Electronics_Receipts_2024.pdf' dated March 15, 2024, for a MacBook Pro purchase of $2,499..."\n\n \n β If this workflow helped you, please give it a star! β\n \n
\n \n <a href="https://github.com/Vipa22aiml/n8n-rag-workflow/issues\">π Report Bug β’\n <a href="https://github.com/Vipa22aiml/n8n-rag-workflow/issues\">π‘ Request Feature β’\n <a href="https://github.com/Vipa22aiml/n8n-rag-workflow/discussions\">π¬ Discussions\n"