A secure, multi-user, and local RAG (Retrieval-Augmented Generation) system for your emails. Chat with your Gmail history using high-performance vector search (pgvector) and local LLMs (Ollama).
- Strict User Isolation: Multi-user support with encrypted credentials and separate metadata-filtered search.
- Hybrid Indexing: Optimized with B-Tree (relational) and HNSW (vector) indexes for millisecond retrieval.
- Real-time Streaming: Token-by-token response rendering for a snappier user experience.
- Conversation Memory: Remembers the last 6 messages (sliding window) to handle follow-up questions.
- Privacy First: Everything runs locally on your machine using Ollama and PostgreSQL.
app.py: Streamlit-based web UI.core/: Core application logic.rag.py: RAG Engine with streaming and memory support.database.py: PostgreSQL & pgvector management.sync_emails.py: Email ingestion and vectorization orchestration.config.py: Centralized configuration and path management.utils/: Security and embedding helper utilities.
ARCHITECTURE.md: Technical system design and component breakdown.EVALUATION.md: Performance and accuracy assessment.
- Python 3.10+
- Ollama: Download and run from ollama.com.
- PostgreSQL: With
pgvectorextension installed.
pip install -r requirements.txtEnsure your PostgreSQL server is running, then provide your connection details in credentials.yaml:
dbname: emails_rag
db_user: postgres
db_password: your_password
db_host: localhost
db_port: 5432ollama pull qwen2.5-coder:3b
ollama pull nomic-embed-textStart the Chatbot:
streamlit run app.py- Architecture Document: ARCHITECTURE.md
- Evaluation Report: EVALUATION.md
- Codebase: Fully modularized and documented.
- Bonus: Robust multi-user isolation and HNSW indexing implemented.