Skip to content

AI-powered email classification engine that extracts category, priority, sentiment, and action items

Notifications You must be signed in to change notification settings

https-deeplearning-ai/email-classifier-ralph-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Email Classifier

AI-powered email classification engine that extracts category, priority, sentiment, and action items from emails.

Live Demo API Docs

Features

  • Smart Classification - Automatically categorizes emails as work, urgent, personal, spam, or social
  • Priority Detection - Identifies email priority level (low, medium, high, critical)
  • Sentiment Analysis - Determines if the email tone is positive, neutral, or negative
  • Action Item Extraction - Pulls out actionable tasks mentioned in the email
  • Structured Output - Pydantic validation ensures consistent, reliable data format
  • Web Interface - Clean, responsive UI for easy interaction without technical setup
  • RESTful API - FastAPI backend with automatic OpenAPI documentation

Tech Stack

FastAPI OpenAI Pydantic Docker Render

  • Backend: FastAPI (Python 3.11)
  • AI Model: OpenAI GPT-4o-mini
  • Validation: Pydantic v2
  • Deployment: Docker on Render
  • Frontend: Vanilla JavaScript

Getting Started

Local Development

# Clone the repository
git clone https://github.com/davidleocadio94/email-classifier-ralph-test.git
cd email-classifier-ralph-test

# Install dependencies
pip install -r requirements.txt

# Set up environment
cp .env.example .env  # Add your OpenAI API key

# Run the application
uvicorn src.api:app --reload

Visit http://localhost:8000 to use the web interface.

Docker

# Build and run with Docker
docker build -t email-classifier .
docker run -p 8000:8000 -e OPENAI_API_KEY=your-key-here email-classifier

API Documentation

Interactive API documentation is available at:

Example API Request

curl -X POST "https://email-classifier-ralph-test.onrender.com/classify" \
  -H "Content-Type: application/json" \
  -d '{"email_text": "Dear team, the quarterly budget meeting is rescheduled to Friday at 3 PM. Please confirm attendance."}'

Example Response

{
  "category": "work",
  "priority": "medium",
  "summary": "Meeting rescheduled to Friday at 3 PM, confirmation requested",
  "requires_action": true,
  "sentiment": "neutral",
  "action_items": ["Confirm attendance for Friday meeting"],
  "deadline": "EOD Thursday",
  "sender_type": "colleague"
}

Project Structure

email-classifier-ralph-test/
├── src/
│   ├── main.py          # EmailClassification model + classify_email function
│   ├── api.py           # FastAPI application with endpoints
│   └── static/
│       └── index.html   # Web UI
├── requirements.txt     # Python dependencies
├── Dockerfile          # Container configuration
├── render.yaml         # Render deployment config
├── .env.example        # Environment template
└── README.md

Built as part of the DeepLearning.AI Pydantic Course

About

AI-powered email classification engine that extracts category, priority, sentiment, and action items

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •