How abhijith13923/ai-intellimail- works
AI Gmail Intelligence Assistant lets a user authenticate with Google, sync Gmail messages into searchable indexes, and ask contextual questions that return grounded answers and source emails. The documented and sampled flow runs from the React chat through the FastAPI query endpoint and RAG orchestrator: parse intent, retrieve dense and keyword matches, rerank, then generate a response with trace data. A separate sync path feeds email into ingestion. The tree and excerpts establish these boundaries; some sync, generation, and storage wiring is inferred only at subsystem level from documentation and filenames.
Main entry points: pipeline.py RAG orchestrator · main.py FastAPI routes · sync.py Email sync · ingestion.py Email ingestion
Components 22
User interface
- Login screen
frontend/src/App.jsx - Chat dashboard
frontend/src/components/ChatDashboard.jsx - Trace inspector
frontend/src/components/ChunkInspector.jsx
API and sync
- FastAPI routes
backend/app/main.py - Google OAuth
backend/app/main.py - Email sync
backend/app/gmail/sync.py - Gmail credentials
backend/app/gmail/auth.py - Gmail fetch
backend/app/gmail/service.py
RAG processing
- RAG orchestrator
backend/app/rag/pipeline.py - Email ingestion
backend/app/rag/ingestion.py - Email chunking
backend/app/rag/chunking.py - Query parsing
backend/app/rag/query_parser.py - Hybrid retrieval
backend/app/rag/retriever.py - Result reranking
backend/app/rag/reranker.py - Answer generation
backend/app/rag/generator.py - Embedding service
backend/app/rag/embeddings.py
Indexes and state
- Sync progress
backend/app/sync_state.py - Chroma vector index
backend/app/rag/vector_store.py - BM25 index
backend/app/rag/bm25_store.py
Other components
- Gmail user
- Google services
- Gemini / LLM
Connections 31
- Gmail user → Login screen: starts login
- Login screen → Google services: requests OAuth code
- Login screen → FastAPI routes: exchanges code
- FastAPI routes → Google services: verifies credentials
- Gmail user → Chat dashboard: asks or syncs
- Chat dashboard → FastAPI routes: calls query and sync
- FastAPI routes → RAG orchestrator: runs query
- RAG orchestrator → Query parsing: parses intent
- Query parsing → Gemini / LLM: extracts filters
- RAG orchestrator → Hybrid retrieval: retrieves candidates
- Hybrid retrieval → Chroma vector index: dense search
- Hybrid retrieval → BM25 index: keyword search
- Chroma vector index → Embedding service: embeds query
- RAG orchestrator → Result reranking: reranks candidates
- RAG orchestrator → Answer generation: generates answer
- Answer generation → Gemini / LLM: produces response
- RAG orchestrator → FastAPI routes: returns answer and trace
- FastAPI routes → Chat dashboard: returns results
- Chat dashboard → Trace inspector: shows retrieval trace
- FastAPI routes → Email sync: starts initial sync
- Email sync → Gmail credentials: gets credentials
- Gmail credentials → Google services: refreshes token
- Email sync → Gmail fetch: fetches messages
- Gmail fetch → Google services: reads Gmail
- Email sync → Sync progress: tracks progress
- Email sync → RAG orchestrator: sends emails for indexing
- RAG orchestrator → Email ingestion: ingests emails
- FastAPI routes → Email ingestion: accepts manual ingest
- Email ingestion → Email chunking: cleans and chunks
- Email ingestion → Chroma vector index: upserts chunks
- Email ingestion → BM25 index: adds documents