File size: 2,544 Bytes
444b206
 
 
 
 
 
ed87b79
444b206
 
369ed63
 
 
 
ed87b79
 
369ed63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
title: AI Support Ticket
emoji: 🎫
colorFrom: blue
colorTo: purple
sdk: docker
pinned: true
---

# AI Customer Support Ticket Resolution (OpenEnv)

An AI-powered support ticket system using AWS Bedrock for automatic ticket classification and resolution suggestions.

Built by [Jainam H. Maru](https://huggingface.co/dev9269) β€” Cybersecurity Engineer & AI Security Researcher

## Features

- **AI Classification** β€” Automatically categorizes tickets (billing, technical, account, shipping, general)
- **Priority Detection** β€” AI assigns priority (low / medium / high / critical)
- **Resolution Suggestions** β€” AI generates resolution drafts using AWS Bedrock (Titan)
- **Confidence Scoring** β€” High-confidence tickets auto-resolve; low-confidence tickets route to agent review
- **Agent Workflow** β€” Agents can review, add notes, override AI, and close tickets
- **Live Stats Dashboard** β€” Real-time metrics on resolution rates and ticket distribution

## Architecture

```
Customer β†’ Submit Ticket β†’ AI Engine (AWS Bedrock)
                               ↓
                    Classify + Generate Resolution
                               ↓
              confidence β‰₯ 0.8 β†’ ai_resolved
              confidence < 0.8 β†’ agent_review
                               ↓
                    Agent Reviews & Closes
```

## Setup

### 1. Install dependencies
```bash
pip install -r requirements.txt
```

### 2. Configure environment
```bash
cp .env.example .env
# Edit .env with your AWS credentials
```

### 3. AWS Bedrock Setup
- Enable **Amazon Titan Text Express** model in AWS Bedrock console
- Ensure your IAM user/role has `bedrock:InvokeModel` permission

### 4. Run
```bash
python main.py
```

Open http://localhost:8000

## API Endpoints

| Method | Endpoint | Description |
|--------|----------|-------------|
| POST | `/tickets` | Submit new ticket (triggers AI analysis) |
| GET | `/tickets` | List tickets (filter by status/priority) |
| GET | `/tickets/{id}` | Get ticket details |
| PATCH | `/tickets/{id}` | Update ticket (agent actions) |
| DELETE | `/tickets/{id}` | Delete ticket |
| GET | `/stats` | Dashboard statistics |

## Project Structure

```
β”œβ”€β”€ main.py          # FastAPI app & routes
β”œβ”€β”€ ai_engine.py     # AWS Bedrock AI classification & resolution
β”œβ”€β”€ models.py        # Pydantic data models
β”œβ”€β”€ index.html       # Frontend UI
β”œβ”€β”€ tickets.json     # Ticket storage
β”œβ”€β”€ .env.example     # Environment config template
└── requirements.txt
```