An intelligent customer support automation system using Retrieval-Augmented Generation (RAG) with multi-LLM support and real-time email processing.
- π§ Gmail Integration: Secure OAuth 2.0 authentication with automatic email monitoring
- π€ AI-Powered Responses: Automated email replies using RAG with multi-LLM fallback (Gemini, Claude)
- π Knowledge Base: Web-based PDF upload and management with semantic search
- π Real-Time Dashboard: Beautiful analytics with ApexCharts and live data updates
- π Separated Auth: Clean architecture with distinct landing and dashboard experiences
- π Multi-User Support: Isolated data per user with session-based authentication
- β‘ Sub-Second Processing: Lightning-fast email classification and response generation
pip install -r requirements.txtCreate a .env file with required credentials:
# LLM Configuration
GOOGLE_API_KEY=your_gemini_api_key
ANTHROPIC_API_KEY=your_claude_api_key # Optional fallback
LLM_PRIMARY_PROVIDER=gemini
LLM_FALLBACK_PROVIDERS=claude
# Vector Database
PINECONE_API_KEY=your_pinecone_api_key
PINECONE_INDEX_NAME=your_index_name
VECTOR_DB_TYPE=pineconeFollow the OAuth Setup Guide to configure Gmail API credentials.
# Start the web dashboard
python wsgi.py
# In another terminal, start the email agent
python run.py agent --poll-interval 60Access the dashboard at http://127.0.0.1:5001
- Python 3.12+
- Flask - Web framework with Blueprint architecture
- Multi-LLM Support: Gemini (primary), Claude (fallback)
- Embeddings: Google Gemini Embeddings (embedding-004)
- Vector DB: Pinecone (with abstraction for future providers)
- Email: Gmail API with OAuth 2.0
- Vanilla JavaScript - No framework dependencies
- ApexCharts - Beautiful, interactive charts
- Flatpickr - Date range selection
- Modern CSS - Glassmorphism, gradients, animations
- Application Factory Pattern - Scalable Flask setup
- Provider System - Abstract LLM and Vector DB providers with automatic fallback
- Separated Auth/Dashboard - Clean routing with
/(landing) and/dashboard - Multi-User Isolation - Session-based auth with per-user data segregation
- Main Documentation Index - Complete documentation map
- Product Requirements (PRD) - Full product specifications
- Main Walkthrough - Installation and usage guide
- OAuth Setup Guide - Gmail API configuration
- Gmail Setup Guide - Detailed Gmail integration
- Architecture Overview - System design and components
- High-Level Design - Deployment and scalability
- Sequence Diagrams - Detailed workflow diagrams
- Code Walkthrough - Critical code flows
- Multi-LLM Architecture - LLM provider system
- Multi-Vector DB Architecture - Vector DB abstraction
- Prompts Guide - System prompts and templates
- Automatic Classification: Intelligent email categorization using LLM
- RAG-Enhanced Responses: Context-aware replies using knowledge base
- Multi-User Isolation: Each user's data completely segregated
- Domain Filtering: Configurable domain exclusion list
- Real-Time Analytics: Email volume charts, category distribution
- Custom Date Ranges: Flexible time period selection with Flatpickr
- Activity Logs: Detailed processing history with filtering
- Knowledge Base Viewer: Browse uploaded documents with pagination
- Landing Page (
/): Unauthenticated landing with features showcase - Dashboard (
/dashboard): Protected dashboard with metrics and charts - Client-Side Routing: Smart redirects based on auth status in
auth.js - Auto-Refresh: Dashboard updates every 30 seconds
RAG-Demo/
βββ app/
β βββ api/ # REST API routes
β βββ web/ # Web page routes
β βββ services/ # Business logic
β β βββ llm_providers/ # Multi-LLM system
β β βββ vector_db_providers/ # Vector DB abstraction
β β βββ gmail/ # Gmail sub-services
β βββ static/
β β βββ css/ # Stylesheets
β β βββ js/ # Client-side logic
β β βββ images/ # Static assets
β βββ templates/ # Jinja2 templates
βββ docs/ # Comprehensive documentation
βββ run.py # CLI entry point
βββ wsgi.py # Web server entry point
pytest tests/Gemini (primary) β Claude (fallback) β Exponential backoff retry
- Automatic provider switching on quota errors (HTTP 429)
- Configurable fallback chain via environment variables
- Transparent to application code
/ (landing.html) ββ /dashboard (dashboard.html)
β β
ββββ auth.js βββββββββ
(redirects based on session)
dashboard.js β /api/metrics/summary β Database
charts.js β /api/metrics/email-volume β Database
β /api/metrics/categories β Database
Screen.Recording.2025-11-22.at.5.38.33.PM.mov
Flux.-.Agent.2.mp4
This is an educational project showcasing RAG implementation with production-ready patterns. Feel free to fork and extend!
MIT License
Last Updated: November 30, 2025
Architecture: Multi-LLM β
| Multi-Vector DB β
| Separated Auth/Dashboard β