Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- supportdesk_env/server/app.py +9 -0
- tests/test_supportdesk.py +16 -0
supportdesk_env/server/app.py
CHANGED
|
@@ -71,6 +71,14 @@ app = create_app(
|
|
| 71 |
)
|
| 72 |
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
def _replace_route(path: str, methods: set[str]) -> None:
|
| 75 |
"""Remove a generated route so we can register a score-aware replacement."""
|
| 76 |
|
|
@@ -149,6 +157,7 @@ def list_tasks() -> dict[str, Any]:
|
|
| 149 |
"tasks": [
|
| 150 |
{
|
| 151 |
"task_id": task.task_id,
|
|
|
|
| 152 |
"title": task.title,
|
| 153 |
"difficulty": task.difficulty,
|
| 154 |
"objective": task.objective,
|
|
|
|
| 71 |
)
|
| 72 |
|
| 73 |
|
| 74 |
+
TASK_GRADER_PATHS = {
|
| 75 |
+
"billing_refund_easy": "graders:BillingRefundEasyGrader",
|
| 76 |
+
"account_takeover_medium": "graders:AccountTakeoverMediumGrader",
|
| 77 |
+
"api_incident_hard": "graders:ApiIncidentHardGrader",
|
| 78 |
+
"regulated_export_exception_hard": "graders:RegulatedExportExceptionHardGrader",
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
|
| 82 |
def _replace_route(path: str, methods: set[str]) -> None:
|
| 83 |
"""Remove a generated route so we can register a score-aware replacement."""
|
| 84 |
|
|
|
|
| 157 |
"tasks": [
|
| 158 |
{
|
| 159 |
"task_id": task.task_id,
|
| 160 |
+
"grader": TASK_GRADER_PATHS[task.task_id],
|
| 161 |
"title": task.title,
|
| 162 |
"difficulty": task.difficulty,
|
| 163 |
"objective": task.objective,
|
tests/test_supportdesk.py
CHANGED
|
@@ -247,3 +247,19 @@ def test_http_explicit_episode_helpers_work():
|
|
| 247 |
assert state_payload["case"]["queue"] == "billing_ops"
|
| 248 |
assert state_payload["case"]["priority"] == "high"
|
| 249 |
assert state_payload["case"]["issue_type"] == "duplicate_charge"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
assert state_payload["case"]["queue"] == "billing_ops"
|
| 248 |
assert state_payload["case"]["priority"] == "high"
|
| 249 |
assert state_payload["case"]["issue_type"] == "duplicate_charge"
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
@pytest.mark.skipif(TestClient is None, reason="httpx is not installed for FastAPI TestClient")
|
| 253 |
+
def test_http_tasks_include_truthy_grader_field():
|
| 254 |
+
from supportdesk_env.server.app import app
|
| 255 |
+
|
| 256 |
+
client = TestClient(app)
|
| 257 |
+
|
| 258 |
+
tasks_response = client.get("/tasks")
|
| 259 |
+
assert tasks_response.status_code == 200
|
| 260 |
+
payload = tasks_response.json()
|
| 261 |
+
|
| 262 |
+
assert payload["total_tasks"] >= 4
|
| 263 |
+
assert len(payload["tasks"]) >= 4
|
| 264 |
+
for task in payload["tasks"]:
|
| 265 |
+
assert task["grader"].startswith("graders:")
|