Spaces:
Sleeping
Sleeping
Fix README metadata
Browse files
README.md
CHANGED
|
@@ -1 +1,77 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Customer Support AI API
|
| 3 |
+
emoji: A
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# ๐ฎ AI Customer Support Simulator
|
| 11 |
+
|
| 12 |
+
A strict, deterministic RL-style environment for training and evaluating AI agents on customer support tasks.
|
| 13 |
+
|
| 14 |
+
## ๐๏ธ Architecture
|
| 15 |
+
|
| 16 |
+
```
|
| 17 |
+
โโโ models.py # Core data models (Episode, StepResult, Task)
|
| 18 |
+
โโโ environment.py # Strict step enforcement + fail logic
|
| 19 |
+
โโโ inference.py # Rule-based agent + CLI runner
|
| 20 |
+
โโโ app.py # Gradio UI
|
| 21 |
+
โโโ tasks/
|
| 22 |
+
โ โโโ easy_task.py # Delayed delivery complaint
|
| 23 |
+
โ โโโ medium_task.py # Billing double-charge
|
| 24 |
+
โ โโโ hard_task.py # Angry VIP threatening legal action
|
| 25 |
+
โโโ graders/
|
| 26 |
+
โ โโโ base_grader.py # BaseGrader + HardTaskGrader
|
| 27 |
+
โโโ tests/
|
| 28 |
+
โโโ test_cases.py # 4 mandatory test scenarios
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
## ๐ฏ Step Flow
|
| 32 |
+
|
| 33 |
+
**Empathy โ Collect Info โ Investigate โ Resolution**
|
| 34 |
+
|
| 35 |
+
Each step must be completed correctly before advancing.
|
| 36 |
+
|
| 37 |
+
## ๐ Reward Formula
|
| 38 |
+
|
| 39 |
+
```
|
| 40 |
+
reward = base_score + step_bonus โ penalty
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
| Component | Value |
|
| 44 |
+
|---------------|--------|
|
| 45 |
+
| Base (correct)| 1.00 |
|
| 46 |
+
| Base (wrong) | 0.20 |
|
| 47 |
+
| Step bonus | 0.20 |
|
| 48 |
+
| Max per step | **1.20** |
|
| 49 |
+
| Episode max | **4.80** |
|
| 50 |
+
|
| 51 |
+
## โ ๏ธ Penalties
|
| 52 |
+
|
| 53 |
+
| Trigger | Penalty |
|
| 54 |
+
|-------------------------------|---------|
|
| 55 |
+
| Wrong action in step | โ0.30 |
|
| 56 |
+
| Repeated response | โ0.20 |
|
| 57 |
+
| Early solution | โ0.25 |
|
| 58 |
+
| Angry customer ignored | โ0.25 |
|
| 59 |
+
| Generic / too-short response | โ0.15 |
|
| 60 |
+
| Wrong assumption | โ0.20 |
|
| 61 |
+
| Skipped step | โ0.30 |
|
| 62 |
+
|
| 63 |
+
## ๐ฅ Fail Conditions
|
| 64 |
+
|
| 65 |
+
- More than **3 wrong steps** across episode
|
| 66 |
+
- Total reward below **1.5**
|
| 67 |
+
- Agent stuck in loop: **3 consecutive failures** at same step
|
| 68 |
+
- Single-step penalty โฅ 0.80
|
| 69 |
+
|
| 70 |
+
## ๐ Local Setup
|
| 71 |
+
|
| 72 |
+
```bash
|
| 73 |
+
pip install -r requirements.txt
|
| 74 |
+
python inference.py --task all --agent rule # CLI test
|
| 75 |
+
python app.py # Gradio UI
|
| 76 |
+
python tests/test_cases.py # Run tests
|
| 77 |
+
```
|