Spaces:
Configuration error
Configuration error
File size: 4,270 Bytes
a43cbb4 | 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 | # Office Workflow OpenEnv Environment
`office_workflow_env` simulates three realistic office tasks humans do and exposes them via OpenEnv’s standard `reset()` / `step()` / `state()` API.
It supports deterministic grading (0.0–1.0) for:
1. `email_triage` (easy)
2. `data_cleaning` (medium)
3. `support_escalation` (hard)
At the end of each episode, the environment writes the final task score to `observation.info.final_score` and the structured breakdown to `observation.info.final_breakdown`.
## Task / Episode API
### Reset
Call `reset(task_id=..., seed=..., episode_id=...)`.
* `task_id`: one of `email_triage`, `data_cleaning`, `support_escalation`
* `seed`: integer seed for deterministic shuffling
### Step
Call `step(action)` where `action` is an `OfficeAction`.
The server returns:
* `observation`: an `OfficeObservation`
* `reward`: scalar float (shaped with partial progress)
* `done`: boolean when the task is finished or `max_steps` is reached
The `info` field is carried inside `observation.info`.
### State
Call `state()` to retrieve `OfficeState` (progress + action trace; no hidden ground truth answers).
## Action Space (`OfficeAction`)
Single action schema for all tasks, discriminated by `type`:
* `type="triage_email"`
* `email_id`: string
* `category`: one of `billing`, `technical`, `spam`, `other`
* `priority`: int in `[0, 5]`
* `type="correct_cell"`
* `row_id`: string
* `column`: one of `email`, `phone`, `date`
* `value`: proposed cleaned value
* `type="support_decision"`
* `ticket_id`: string
* `intent`: one of `ask_for_information`, `resolve`, `escalate`
* `reply`: draft reply text
* plus intent-specific fields:
* `requested_info` (when `ask_for_information`)
* `resolution_steps` (when `resolve`)
* `escalation_reason` (when `escalate`)
Optional helper actions:
* `type="request_status"`
* `type="noop"`
## Observation Space (`OfficeObservation`)
Common fields:
* `task_id`, `status`, `max_steps`, `step_index`
Task-specific fields:
* `email_triage`: `emails`, `triaged`
* `data_cleaning`: `dataset`, `cleaned_cells`
* `support_escalation`: `tickets`, `handled_tickets`
Grader-facing info:
* `info.objective`, `info.completion_rule` (task instructions)
* `info.reward_breakdown` (per-step reward component breakdown)
* final episode results in `info.final_score` and `info.final_breakdown`
## Reward Shaping (partial progress)
Rewards are not binary: they increase as the agent makes correct partial progress.
All tasks:
* progress component grows with corrected/handled items
* correctness component rewards correct submissions
* stalling/wrong actions are penalized by driving reward toward `0.0`
## Local Setup
### Step-by-step (Windows / PowerShell)
1. Open a terminal in `c:\Users\hp\Desktop\hackathon`
2. Install dependencies:
```bash
python -m pip install -U pip
python -m pip install "openenv-core[core]>=0.2.1" openai requests uvicorn
```
3. Validate OpenEnv structure:
```bash
openenv validate
```
4. Start the server:
```bash
uvicorn server.app:app --host 0.0.0.0 --port 8000
```
5. Confirm it responds:
- `http://localhost:8000/health`
- `http://localhost:8000/docs`
6. Run the connectivity smoke test (expected score 0.0 because it sends only `noop`):
```bash
python scripts/smoke_test.py
```
7. Run a “real” local demo baseline (no OpenAI key required; rule-based):
```bash
python scripts/baseline_inference.py
```
## Baseline Inference (OpenAI)
The baseline script runs a model against all 3 tasks and prints reproducible scores.
Environment variables:
* `OPENAI_API_KEY`
* `OPENAI_MODEL` (optional, default `gpt-4o-mini`)
* `OPENENV_BASE_URL` (optional, default `http://localhost:8000`)
* `BASELINE_SEED` (optional, default `123`)
Run:
```bash
python scripts/baseline_inference.py
```
## Hugging Face Spaces Deployment
This repo includes a `server/Dockerfile` suitable for Hugging Face Spaces.
When you’re ready to deploy:
```bash
openenv validate
openenv push --repo-id YOUR_HF_USERNAME/office-workflow-env
```
`openenv push` will package the environment and build the Docker image for Spaces.
After it deploys, validate the running Space:
```bash
openenv validate https://YOUR_HF_USERNAME-office-workflow-env.hf.space
```
|