Spaces:
No application file
No application file
File size: 4,253 Bytes
b6f9e96 05b75ac b6f9e96 05b75ac b6f9e96 05b75ac b6f9e96 05b75ac b6f9e96 05b75ac | 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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | # PRD: SupportEnv β AI Customer Support RL Environment
## Overview
Build a complete OpenEnv-compliant environment that simulates a real-world customer support system where an AI agent can:
- Classify support tickets
- Search Knowledge Base (lookup_kb)
- Generate empathetic responses
- Decide escalation (de-escalate if possible)
- Resolve issues efficiently
### Requirements
- Follow OpenEnv spec: `reset()`, `step()`, `state()`
- Include 3 tasks (easy β medium β hard)
- Include deterministic graders (0.0β1.0)
- Include baseline inference
- Deploy via Docker + Hugging Face Spaces
---
## Task 1: Project Setup & Structure
Create full project structure:
SupportEnv/
βββ models.py # Typed Action, Observation, State
βββ client.py # WebSocket client for external use
βββ openenv.yaml # Environment metadata
βββ pyproject.toml # Package dependencies
βββ requirements.txt # Pip requirements
βββ README.md # Documentation
β
βββ server/
β βββ __init__.py
β βββ app.py # FastAPI application
β βββ environment.py # Core RL logic
β βββ tasks.py # Task definitions (easy/medium/hard)
β βββ graders.py # Deterministic scoring
β βββ reward.py # Reward computation
β βββ ticket_generator.py # Realistic ticket generation
β βββ utils.py # Helper functions
β βββ Dockerfile # Container definition
β
βββ baseline/
β βββ __init__.py
β βββ run_baseline.py # Baseline execution script
β βββ policy.py # Rule-based baseline agent
β βββ results.json # Saved baseline scores
β
βββ frontend/
β βββ __init__.py
β βββ gradio_ui.py # Gradio interface
β
βββ tests/
β βββ __init__.py
β βββ test_environment.py
β βββ test_graders.py
β βββ test_api.py
β βββ test_baseline.py
β
βββ scripts/
βββ start_local.sh
βββ validate.sh
βββ deploy.sh
### Requirements
- Follow OpenEnv structure
- All files created (no placeholders)
- Project runs locally without errors
---
## Task 2: Define Typed Models
### Action
- `action_type`: classify | respond | escalate | resolve | lookup_kb | request_info
- `content`: string
### Observation
- `ticket_text`
- `history`
- `customer_sentiment`
- `issue_category`
### State
- `episode_id`
- `step_count`
- `resolved`
### Requirements
- Fully typed (Pydantic)
- OpenEnv compatible
- No missing fields
---
## Task 3: Implement Ticket Generator
### Features
Generate tickets for:
- Billing
- Technical
- Account
Include:
- Difficulty (easy / medium / hard)
- Sentiment score
- Keywords
### Requirements
- Minimum 20 tickets
- Include ambiguous hard cases
- Deterministic with seed
---
## Task 4: Implement Environment Core
### reset()
- Generate new ticket
- Initialize state
- Clear history
### step(action)
Handle:
- classify
- respond
- escalate
- resolve
Return:
- observation
- reward
- done
### state()
- Return metadata
### Requirements
- Multi-step interaction supported
- Episode ends correctly
- No crashes on invalid input
---
## Task 5: Implement Reward System
### Rewards
- Correct classification β +0.25
- Hybrid Semantic Response Quality β +0.30
- Appropriate KB usage β +0.15
- Correct escalation decision β +0.35
- Successful resolution β +0.40
- Wrong escalation β -0.20
- Missed mandatory escalation β -0.35
- Harmful response β -0.40
### Requirements
- Step-level rewards
- Not purely binary
- Penalizes bad behavior
---
## Task 6: Implement Grader System
### Evaluate
- Classification accuracy
- Response quality (Semantic + Keyword)
- Escalation correctness (with mandatory de-escalation for hard tasks)
- Resolution Alignment
- Efficiency (Penalizing superficial handling of hard tasks)
### Output
- Scalar score [0.0, 1.0]
- Detailed breakdown by difficulty
- Passing status (score > 0.8)
|