Download projects/elizabeth/scripts/eval_gate.py from LevelUp2x/adaptai: direct link, hf CLI and curl.
- Browser
- Download file 1.91 kB
-
https://huggingface.co/datasets/LevelUp2x/adaptai/resolve/main/projects/elizabeth/scripts/eval_gate.py
- Command line
-
hf download hf://datasets/LevelUp2x/adaptai/projects/elizabeth/scripts/eval_gate.py
-
curl -L -o eval_gate.py https://huggingface.co/datasets/LevelUp2x/adaptai/resolve/main/projects/elizabeth/scripts/eval_gate.py
1.91 kB
| #!/usr/bin/env python3 | |
| """ | |
| Run a minimal eval gate and return results for a Nova receipt. | |
| Usage: | |
| python scripts/eval_gate.py \ | |
| --session-id ... --turn-id ... \ | |
| --tool-results-json path/to/nova_tool_results.json | |
| Returns JSON to stdout. | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| def parse_args() -> argparse.Namespace: | |
| p = argparse.ArgumentParser() | |
| p.add_argument("--session-id", required=True) | |
| p.add_argument("--turn-id", required=True) | |
| p.add_argument("--tool-results-json", help="Path to a JSON or JSONL file with tool results") | |
| return p.parse_args() | |
| def run_evals(args: argparse.Namespace) -> dict: | |
| # Placeholder for actual evaluation logic | |
| # Tool correctness: For now, assume success if tool_results_json is provided and not empty | |
| tool_correctness_pass = False | |
| if args.tool_results_json and Path(args.tool_results_json).exists(): | |
| try: | |
| with open(args.tool_results_json, 'r') as f: | |
| data = json.load(f) | |
| if data.get("nova_tool_results"): | |
| tool_correctness_pass = True | |
| except Exception: | |
| pass | |
| # Persona score: Placeholder, always pass for now | |
| persona_score_pass = True | |
| # Overall gate pass/fail | |
| gate_passed = tool_correctness_pass and persona_score_pass | |
| return { | |
| "gate_passed": gate_passed, | |
| "tool_correctness": { | |
| "passed": tool_correctness_pass, | |
| "notes": "Placeholder: Assumed pass if tool results present." | |
| }, | |
| "persona_score": { | |
| "passed": persona_score_pass, | |
| "score": 0.0, # Placeholder | |
| "notes": "Placeholder: Always passes." | |
| } | |
| } | |
| def main() -> None: | |
| args = parse_args() | |
| eval_results = run_evals(args) | |
| print(json.dumps(eval_results, indent=2)) | |
| if __name__ == "__main__": | |
| main() | |