A powerful, terminal-based AI assistant that securely accesses your Gmail inbox, summarizes unread emails using a local LLaMA2 model via Olama API, and enables interactive, natural language querying of your email content through semantic search powered by ChromaDB and dynamic LLM-generated responses.
- Secure OAuth2 authentication with Gmail API
- Fetch and summarize top unread emails in concise bullet points
- Store email content and summaries as embeddings in ChromaDB for efficient semantic retrieval
- Intelligent chat interface for asking detailed questions about your emails
- Fully local deployment, ensuring privacy and control—no cloud AI services required
- Python 3.11 or later
- Olama CLI installed with LLaMA2 model
- Active Google Cloud project with Gmail API enabled and OAuth2 credentials (
credentials.json
)
- Clone the repository
git clone cd
text
- Create and activate a virtual environment (recommended)
python3 -m venv venv source venv/bin/activate
text
- Install dependencies
pip install -r requirements.txt
text
- Add Gmail OAuth2 credentials
- Follow Google's guide to create OAuth 2.0 credentials for a desktop application in your Google Cloud Console
- Download the
credentials.json
file - Place it in the project root directory
- Important: Never commit or share this file publicly
- Download and run Olama LLaMA2 model locally
olama pull llama2 olama run llama2
text
Run the bot with:
PYTHONPATH=$(pwd) python email_bot.py
text
- Enter the number of unread emails you want to summarize
- Review the individual email summaries and the general summary provided
- Enter the interactive chat mode that lets you ask natural language questions about your emails
- Type
exit
orquit
to close the chat session
- Authentication issues: Delete
token.json
to reset Gmail authorization - No responses or failures: Verify that your Olama LLaMA2 server is running and accessible at http://localhost:11434/api/generate
- File permission errors: Ensure the project folders (
chroma_db/
andsummaries/
) have proper read/write permissions