limyewjin / email-assistant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GPT-4 Email Assistant

This project provides a GPT-4 email assistant that responds to emails and fulfills various tasks for the user. The assistant has access to numerous commands, resources, and can interact with Google Calendar API. To set up the project, follow the instructions below.

Demo Video

GPT-4.Email.Assistant.mp4

YouTube link

Requirements

Python 3.8 or higher

Setup

  1. Install the required packages using requirements.txt:
pip install -r requirements.txt
  1. Follow the instructions at Google Calendar Simple API Getting Started to set up the Google Calendar API credentials. Copy the credentials to ~/.credentials

  2. Set up an email account for your bot which you will use to email to and the bot will monitor. I used Gmail and got an app password.

  3. Set up a serper.dev account to provide Search.

Environment Variables

To set up environment variables for the project, rename the sample_env file to .env and fill in the necessary information. Here's a description of each variable:

  • OPENAI_API_KEY: Your OpenAI API key for the GPT-4 model.
  • SERPER_API_KEY: Your serper.dev API key for search functionality.
  • EMAIL_USER: The email address of your bot.
  • EMAIL_PASSWORD: The API key or password for your bot's email account.
  • EXPECTED_SENDERS: A comma-separated list of email addresses that are allowed to send commands to the bot.
  • CALENDAR_USER: The google calendar user.
  • CALENDAR_TOKEN_PICKLE: File location of token pickle from Google Calendar install above.

Example:

OPENAI_API_KEY=your_openai_key
SERPER_API_KEY=your_serper_key
SCRAPINGANT_API_KEY=your_scrapingant_key (optional)
EMAIL_USER=your_bot_email@example.com
EMAIL_PASSWORD=your_bot_email_password
EXPECTED_SENDERS=user1@example.com,user2@example.com
CALENDAR_USER=user@gmail.com
CALENDAR_TOKEN_PATH=/home/user/.credentials/token.pickle

Running

Run the email assistant which runs in a loop - I just ran mine in screen and detach it:

python code/main.py

To test on console run with --testconsole argument:

python code/main.py --testconsole

Acknowledgements

About

License:MIT License


Languages

Language:Python 100.0%