An open API service indexing awesome lists of open source software.

https://github.com/literalkrishu/ai-powered-email-assistant

AI-Powered-Email-Assistant is designed to help support teams manage hundreds (or thousands) of daily emails efficiently. It automatically retrieves support emails, analyzes sentiment, assigns priority, extracts key details, and generates context-aware replies using LLMs.
https://github.com/literalkrishu/ai-powered-email-assistant

docker docker-compose faiss fastapi huggingface nodejs postgresql python-3 rag reactjs recharts tailwindcss uvicorn

Last synced: 2 months ago
JSON representation

AI-Powered-Email-Assistant is designed to help support teams manage hundreds (or thousands) of daily emails efficiently. It automatically retrieves support emails, analyzes sentiment, assigns priority, extracts key details, and generates context-aware replies using LLMs.

Awesome Lists containing this project

README

          

# πŸ“§ AI-Powered-Email-Assistant

> πŸ€– Intelligent email management system for modern organizations.
> Fetches, categorizes, prioritizes, and drafts AI-powered responses to customer support emails.

![Build](https://img.shields.io/badge/build-MVP-informational?style=flat-square)
![Tech Stack](https://img.shields.io/badge/stack-FastAPI%2C%20React%2C%20Postgres-blue?style=flat-square)
![License](https://img.shields.io/badge/license-MIT-green?style=flat-square)

---

## πŸš€ Project Objective

**AI-Powered-Email-Assistant** is designed to help support teams manage **hundreds (or thousands) of daily emails** efficiently.
It automatically **retrieves support emails, analyzes sentiment, assigns priority, extracts key details, and generates context-aware replies** using LLMs.

This ensures **faster, empathetic, and accurate responses**, reducing manual effort while boosting customer satisfaction.

---

## 🧱 Architecture & Workflow

```text
β”Œ ───────────────────── ┐
β”‚ Email Server β”‚
β”‚ (Gmail/Outlook/IMAP) β”‚
β”” ───────────────────── β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Email Retrieval Layer β”‚
β”‚ (IMAP/Gmail API) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
Raw Emails
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Preprocessing & NLP β”‚
β”‚ - Filtering β”‚
β”‚ - Sentiment Analysis β”‚
β”‚ - Priority Detection β”‚
β”‚ - Info Extraction β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ AI Response Generator β”‚
β”‚ - Context Embedding β”‚
β”‚ - RAG (Knowledge Base)β”‚
β”‚ - LLM Draft Replies β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Database (Postgres) β”‚
β”‚ Emails + Metadata β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Dashboard (React/Next)β”‚
β”‚ - Email List + Detailsβ”‚
β”‚ - Analytics & Stats β”‚
β”‚ - Draft Reply Review β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## πŸ“¦ Tech Stack

| Layer | Technology |
|-------------|---------------------------------------|
| Backend | Python, FastAPI, Uvicorn |
| NLP / AI | Hugging Face (DistilBERT, RoBERTa), OpenAI GPT, FAISS for RAG |
| Database | PostgreSQL |
| Frontend | React / Next.js, TailwindCSS, Recharts |
| Deployment | Docker, docker-compose |

---

## πŸ—‚ Project Phases & Deliverables

### Phase 1: Planning & Setup
- Define requirements
- Setup repo, `.env`, base project structure
πŸ“ Deliverables:
`README.md`, base FastAPI app, frontend scaffold

---

### Phase 2: Email Retrieval & Storage
- Connect to Gmail/Outlook IMAP API
- Filter subjects: *Support, Query, Request, Help*
- Store raw + metadata in PostgreSQL
πŸ“ Deliverables:
`/backend/email_service.py`, database schema

---

### Phase 3: NLP Processing
- Sentiment classification (Positive/Negative/Neutral)
- Urgency detection (keywords: *immediately, critical, cannot access*)
- Information extraction (phone, product, requirements)
πŸ“ Deliverables:
`/backend/nlp_pipeline.py`, test data runs

---

### Phase 4: AI-Powered Responses
- RAG layer for contextual replies (knowledge base + embeddings)
- LLM draft reply generation (empathetic + product-aware)
πŸ“ Deliverables:
`/backend/ai_responder.py`, OpenAI integration

---

### Phase 5: Dashboard Development
- List emails (sortable by priority)
- Email detail view (raw + extracted info + AI draft)
- Analytics: total emails, sentiment breakdown, pending vs resolved
πŸ“ Deliverables:
`/frontend/pages/*.tsx`, `Recharts` graphs

---

### Phase 6: Final Integration & Testing
- SMTP/Gmail API for sending replies
- Docker-compose setup for full stack
πŸ“ Deliverables:
Working end-to-end MVP

---

## βš™οΈ Setup Instructions

### Backend Setup
1. Navigate to project:
```bash
cd AI-Powered-Email-Assistant
```
2. Create virtual environment:
```bash
python -m venv venv
```
3. Activate environment:
- Windows: `venv\Scripts\activate`
- macOS/Linux: `source venv/bin/activate`
4. Install dependencies:
```bash
pip install -r requirements.txt
```
5. Update `.env` with actual credentials.
6. Run app:
```bash
uvicorn app.main:app --reload
```

### Frontend Setup
1. Navigate to frontend:
```bash
cd frontend
```
2. Install dependencies:
```bash
npm install
```
3. Install Recharts:
```bash
npm install recharts
```
4. Start dev server:
```bash
npm run dev
```

### Docker Setup (Optional)
1. Update `.env` with credentials.
2. Run:
```bash
docker-compose up
```

---

## 🌐 Access the Application
- Backend API β†’ [http://localhost:8000](http://localhost:8000)
- Frontend β†’ [http://localhost:3000](http://localhost:3000)
- API Docs β†’ [http://localhost:8000/docs](http://localhost:8000/docs)

---

## ⚠️ Notes
- Enable **IMAP** and generate an **App Password** for Gmail.
- Requires **OpenAI API key** (or custom LLM endpoint).
- Ensure **PostgreSQL** is running and accessible.

---

## πŸ“§ Example Email Flow

**Raw Email**
```
From: diana@client.co
Subject: URGENT - General query about subscription
Body: Hi team, I am unable to log into my account since yesterday. Please fix this immediately. My phone number is 9876543210.
```

**Extracted Info**
- Sender: `diana@client.co`
- Subject: "URGENT - General query about subscription"
- Sentiment: Negative
- Priority: Urgent
- Phone: 9876543210
- Requirement: Account recovery

**AI Draft Response**
```
Hi [Customer Name],

I understand how frustrating it must be to be locked out of your account, and I sincerely apologize for the inconvenience.
Our support team is already looking into this issue, and we will help restore your account access as quickly as possible.

I will personally ensure this case is treated with top priority. Meanwhile, could you please confirm the last login attempt (date/time) for verification?

Thank you for your patience.

Best regards,
[Your Support Team]
```

---