DGXAI/driftcall-env
0
1---2title: DriftCall Env3emoji: ๐ซ4colorFrom: indigo5colorTo: pink6sdk: docker7pinned: true8license: apache-2.09short_description: Indic voice concierge env under schema drift10tags:11 - openenv12 - rl13 - voice14 - indic15 - schema-drift16 - grpo17---18 19# DriftCall โ OpenEnv Env Space20 21OpenEnv-compliant RL environment exposing **DriftCall**, a voice-first Indic22consumer concierge env under schema / policy / pricing / auth drift.23 24## REST surface (OpenEnv v1.0)25 26| Method | Path | Purpose |27|--------|-------------|---------|28| `GET` | `/healthz` | Health probe (unauthenticated). |29| `POST` | `/reset` | Create or recycle a session. |30| `POST` | `/step` | Advance one turn. |31| `GET` | `/state` | Read `DriftCallState`. |32| `POST` | `/close` | Evict a session. |33 34All mutating endpoints require:35 36```37Authorization: Bearer <DRIFTCALL_ENV_TOKEN>38X-Session-Id: [A-Za-z0-9_-]{1,64}39```40 41Error envelope:42 43```json44{ "error": { "code": "<slug>", "message": "<str>", "request_id": "<asgi-id>" } }45```46 47`Cache-Control: no-store` on every response. Only `M5 max_sessions` carries48`Retry-After: 30`. No stack traces ever leak.49 50## Action / observation schemas51 52- Action: `cells.step_04_models:DriftCallAction`53- Observation: `cells.step_04_models:DriftCallObservation`54 55## Reward function56 57Reward is a scalar in `[-1.0, 1.0]`, computed at episode termination from58five independent components, combined โ calibrated โ clamped:59 60| ID | Component | Weight | Implementation |61|---:|---|---:|---|62| R1 | `task_completion` | 0.40 | `cells.step_08_rewards:task_completion` |63| R2 | `drift_detection` | 0.20 | `cells.step_08_rewards:drift_detection` |64| R3 | `constraint_adherence` | 0.20 | `cells.step_08_rewards:constraint_adherence` |65| R4 | `format_compliance` | 0.10 | `cells.step_08_rewards:format_compliance` |66| R5 | `anti_hack_penalty` | 0.10 | `cells.step_08_rewards:anti_hack_penalty` |67 68Pipeline:69 70```python71quality = combine_quality(R1..R5, weights)72brier = brier_penalty(confidence, R1)73reward_raw = quality * (1 - brier)74reward = apply_uncertain_floor(reward_raw, confidence, quality) # floor=0.5075final := clamp(reward, -1.0, 1.0)76```77 78**Hard rule (CLAUDE.md ยง13):** No LLM judge anywhere in this pipeline.79Every reward bit traces to deterministic, schema-grounded checks against80the episode trace + the (possibly drifted) vendor schemas in `data/`.81 82Full spec: `docs/modules/rewards.md` in the source repo.83 84## Episode params (passed in `/reset`)85 86| Field | Type | Range | Required |87|---|---|---|---|88| `seed` | int | โ | no |89| `curriculum_stage` | int | 1โ3 | no |90| `language_weights` | object | โ | no |91| `audio_boundary_enabled` | bool | โ | no |92 93`max_turns = 16` per episode.94 95## Build / deploy96 97```bash98# from repo root99bash deploy/env_space/build.sh # builds deploy/env_space/build/100bash deploy/env_space/build.sh --push # builds + uploads to HF_SPACE_REPO101 102# env vars103HF_SPACE_REPO default: DGXAI/driftcall-env104HF_TOKEN required for --push105```106 107## Sources108 109This Space is built from `deploy/env_space/build.sh` which rsyncs the110canonical sources at the repo root:111 112- `app.py` โ FastAPI / OpenEnv server (786 LOC)113- `cells/` โ importable modules (env, drift injector, rewards, โฆ)114- `data/` โ authored fixtures (briefs, drift patterns, schemas)115- `Dockerfile` โ multi-stage CPU image; Kokoro + faster-whisper baked in116- `openenv.yaml` โ manifest validated by `openenv validate .`117- `requirements.txt` โ runtime deps (no training stack)118 119The model + LoRA adapter are **not** baked into the Space โ eval calls reach120out to HF Hub for the trained adapter (`DGXAI/gemma-3n-e2b-driftcall-lora`).121 