|
Download code/README.md from Fektor/OnCallVal: direct link, hf CLI and curl.
- Browser
- Download file 1.67 kB
-
https://huggingface.co/datasets/Fektor/OnCallVal/resolve/main/code/README.md
- Command line
-
hf download hf://datasets/Fektor/OnCallVal/code/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Fektor/OnCallVal/resolve/main/code/README.md
1.67 kB
| # Running OnCallVal from this dataset | |
| Self-contained: the environment, scorer, generator, and runners are here. | |
| ```bash | |
| pip install pyarrow # only to read test.parquet; the code is stdlib-only | |
| # 1. inspect a task | |
| python - <<'PY' | |
| import json, pyarrow.parquet as pq | |
| rows = pq.read_table("../test.parquet").to_pylist() | |
| task = rows[0] | |
| print(task["task_id"], task["difficulty"], task["alert"]) | |
| PY | |
| # 2. wire up an episode by hand | |
| python - <<'PY' | |
| import json, sys, pyarrow.parquet as pq | |
| sys.path.insert(0, ".") | |
| from oncallval.env import Episode | |
| from oncallval.score import score_episode, truth_from_spec | |
| row = pq.read_table("../test.parquet").to_pylist()[0] | |
| task = dict(row); task["spec"] = json.loads(row["spec"]) | |
| ep = Episode(task) | |
| print(ep.system_prompt()) | |
| ep.step({"action": "list_services"}) | |
| ep.step({"action": "submit_report", "cause": "bad_deploy:public-gw", "fix_summary": "x"}) | |
| print(score_episode(ep, truth_from_spec(task))) | |
| PY | |
| # 3. export to jsonl (the harness reads jsonl, not parquet), then run any | |
| # OpenAI-compatible endpoint | |
| python - <<'PY' | |
| import json, pyarrow.parquet as pq | |
| rows = pq.read_table("../test.parquet").to_pylist() | |
| with open("tasks.jsonl", "w", encoding="utf-8") as f: | |
| for r in rows: | |
| f.write(json.dumps(r) + " | |
| ") | |
| PY | |
| OPENAI_BASE_URL=https://api.openai.com/v1 OPENAI_API_KEY=sk-... python -m oncallval.harness --tasks tasks.jsonl --agent llm --model <model> --out run.jsonl | |
| ``` | |
| Notes: | |
| - `truth_from_spec` derives the answer key from the task spec, so there is no | |
| answers file to leak or lose. | |
| - Never pass `spec` to the agent. It sees `alert` and action observations only. | |