This project creates an automated email assistant that reads incoming emails and generates replies using Google's Gemini LLM through AgnoAI.
- Install the required dependencies:
pip install -r requirements.txt-
Set up Google Cloud Project and Gmail API:
- Go to the Google Cloud Console
- Create a new project
- Enable the Gmail API
- Create OAuth 2.0 credentials
- Download the credentials and save them as
credentials.jsonin the project directory
-
Create a
.envfile in the project directory with the following content:
GEMINI_API_KEY=your_gemini_api_key_here
[email protected]
- Get your Gemini API key:
- Go to Google AI Studio
- Create an API key
- Add it to your
.envfile
- Run the script:
python main.py-
On first run, you'll be prompted to authorize the application to access your Gmail account. Follow the browser prompts to complete the authorization.
-
The script will:
- Read the 5 most recent emails in your inbox
- Generate replies using Gemini LLM
- Send the replies automatically
- Automated email reading and reply generation
- Uses Gemini LLM for intelligent response generation
- Handles both plain text and multipart emails
- Secure credential management
- Error handling and logging
- Never commit your
.envfile orcredentials.jsonto version control - Keep your API keys secure
- The script uses OAuth 2.0 for secure Gmail access