Skip to content

benthecoder/gmail_llm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

577770a Β· Jan 17, 2024

History

5 Commits
Jan 17, 2024
Jan 17, 2024
Dec 4, 2023
Dec 4, 2023
Jan 17, 2024
Jan 17, 2024
Dec 4, 2023

Repository files navigation

Gmail LLM

cover

Using GPT4 to extract interesting links from my daily newsletters

Why? I spend too much time opening and checking through all my newsletters subscriptions, would rather have all interesting links in one page.

Inspired by isafulf/inbox_cleaner

Images

cli

email sample

Prerequisites

  • Python 3.10 or higher
  • Gmail account
  • Google Cloud account with Gmail API enabled
  • OpenAI API key

Setup

  1. Clone repo:

    git clone https://github.com/benthecoder/gmail_llm.git
    cd gmail_llm
    
  2. Install packages:

    pip install -r requirements.txt
    
  3. Set up Google API credentials:

    • create a new OAuth 2.0 Client ID (instructions)
    • Download JSON file and rename it to credentials.json.
    • Put credentials.json in the gmail_llm directory.
  4. Set OpenAI API key:

    • Get an OpenAI API key here
    • Rename .env.local to .env and set your key
    OPENAI_API_KEY=<YOUR_API_KEY>
    

Usage

Run the script:

python main.py

see an example in summary folder

TODO

  • improve prompt to extract as many links as possible and have better categorization
  • Experiment with different forms of output, maybe article form? Have it copy someone's writing style, publish it to substack, could be a newsletter automation with AI thing
  • Check if text extracted from emails can be cleaned up, any redundant info fed into prompt?
  • Run this on cloud/local and dump results in DB so I can read into my blog or in notion

Links