An AI-powered Gmail assistant that lets you ask questions about your inbox using natural language. Built with Retrieval-Augmented Generation (RAG) to retrieve relevant email content and generate answers using an LLM.
Built with Python, Streamlit, OpenAI, Embedchain, ChromaDB, and the Gmail API.
- 📬 Chat with your Gmail inbox in natural language
- 🔎 Semantic retrieval of relevant email content
- 🤖 AI-generated answers powered by OpenAI models
- ⚡ Fast vector search using ChromaDB
- 🖥️ Interactive UI built with Streamlit
- 🔐 Secure Gmail authentication via OAuth 2.0
Example queries:
- "Summarize my recent emails"
- "Any emails about payments?"
- "Who emailed me today?"
- "Do I have any emails about interviews?"
This app follows a standard RAG (Retrieval-Augmented Generation) workflow:
- Gmail emails are fetched using the Gmail API
- Emails are converted into vector embeddings using OpenAI
- Embeddings are stored in a ChromaDB vector database
- When a user asks a question:
- Relevant email chunks are retrieved from the vector database
- The OpenAI LLM generates an answer using the retrieved context as a prompt
User Question
→ Streamlit Interface
→ Embedchain Pipeline
→ ChromaDB Vector Database
→ Relevant Email Context
→ OpenAI LLM
→ Generated Answer
| Layer | Technology |
|---|---|
| Frontend | Streamlit |
| LLM & Embeddings | OpenAI API |
| RAG Pipeline | Embedchain |
| Vector Store | ChromaDB |
| Email Integration | Gmail API |
| Auth | OAuth 2.0 |
| Language | Python |
1. Clone the repository:
git clone https://github.com/YOUR_USERNAME/Gmail_RAG_app.git
cd Gmail_RAG_app2. Install dependencies:
pip install -r requirements.txt- Go to the Google Cloud Console
- Create a new project
- Enable the Gmail API
- Create an OAuth Client ID (Desktop App type)
- Download the credentials file and rename it to
credentials.json - Place
credentials.jsonin the project root folder
streamlit run app.pyA browser window will open where you can:
- Enter your OpenAI API key
- Authenticate with your Google account
- Start chatting with your Gmail inbox
Gmail_RAG_app/
├── app.py
├── requirements.txt
├── README.md
└── .gitignore
The following files contain sensitive credentials and must not be committed to GitHub. Add them to your .gitignore:
credentials.json
token.json
- AI-generated daily email summaries
- Automatic action item extraction
- Email topic clustering
- Semantic email search filters
- Slack / Teams integration
This project is intended for educational and demonstration purposes only.