Skip to content

avithal/AWSDC

Repository files navigation

📧 AWSDC — AI-Powered Email Processor

An intelligent email processing pipeline that reads unread Gmail messages, classifies them using a local LLM (DeepSeek via Ollama), and automatically summarizes or drafts replies based on category.


Architecture

Gmail Inbox ──▶ readEmail.py ──▶ EmailConductor.py ──▶ Ollama / DeepSeek LLM
                     │                   │
                     │                   ├─ classify_email()
                     │                   ├─ summarize_email()
                     │                   └─ draft_reply_email()
                     │                   │
                     └───────── EmailRecord (dataclass) ◀──┘
Module Purpose
EmailRecord.py Dataclass holding email fields: id, subject, body, category, action, summary, draft_reply
EmailConductor.py LLM chains for classification, summarization, and reply drafting; action routing logic
readEmail.py Connects to Gmail via IMAP, extracts subject/body, and sends each email through the pipeline

Category → Action Mapping

Category Action
Spam / Scam 🗑️ Delete / Ignore
Friends / Personal 📝 Summarize + Draft Reply
Delivery 📦 Summarize
Scheduling 📅 Summarize + Draft Reply
Other 🔍 Review Manually

Setup

Prerequisites

  • Python 3.10+
  • Ollama running locally with the deepseek-r1:8b model pulled
  • A Gmail account with an App Password enabled

Installation

# Clone the repo
git clone <repo-url> && cd AWSDC

# Create a virtual environment
python -m venv .venv
.venv\Scripts\activate   # Windows

# Install dependencies
pip install -r requirements.txt

Environment Variables

Create a .env file in the project root:

EMAIL=your_email@gmail.com
PASSWORD=your_16_char_app_password

Pull the LLM Model

ollama pull deepseek-r1:8b

Usage

Process live emails from Gmail

python readEmail.py

This will:

  1. Connect to your Gmail inbox
  2. Fetch all unread emails
  3. Classify, summarize, and (where applicable) draft replies
  4. Print each EmailRecord to the console

Test classification standalone

python EmailConductor.py

Runs a hardcoded spam email through the full pipeline to verify the LLM chain is working.


Project Structure

AWSDC/
├── .env                  # Gmail credentials (not committed)
├── EmailRecord.py        # EmailRecord dataclass
├── EmailConductor.py     # LLM classification / summarization / drafting
├── readEmail.py          # Gmail IMAP reader + pipeline entry point
├── class_diagram.puml    # PlantUML class diagram
├── requirements.txt      # Python dependencies
└── README.md             # This file

UML Diagram

A PlantUML class diagram is available at class_diagram.puml.
Render it with the PlantUML VS Code extension or at plantuml.com.

About

emailorganizer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages