Skip to content

Commit 7f405c5

Browse files
committed
add: standalone eval validation script
1 parent 5687042 commit 7f405c5

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

scripts/validate-evals.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env python3
2+
"""Validate eval test_cases.yaml files."""
3+
import sys, os
4+
5+
try:
6+
import yaml
7+
except ImportError:
8+
print("Installing pyyaml...")
9+
os.system(f"{sys.executable} -m pip install -q pyyaml")
10+
import yaml
11+
12+
skills = ["plan-product", "plan-eng", "code-review", "ship", "qa", "retro"]
13+
errors = 0
14+
15+
for skill in skills:
16+
path = f"{skill}/evals/test_cases.yaml"
17+
if not os.path.isfile(path):
18+
print(f"\u274c {skill}: evals/test_cases.yaml missing")
19+
errors += 1
20+
continue
21+
22+
with open(path) as f:
23+
data = yaml.safe_load(f)
24+
25+
if not isinstance(data, list):
26+
print(f"\u274c {skill}: must be a YAML list")
27+
errors += 1
28+
continue
29+
30+
for i, case in enumerate(data):
31+
for field in ["id", "prompt", "expectations"]:
32+
if field not in case or not case[field]:
33+
print(f"\u274c {skill}: case {i} missing '{field}'")
34+
errors += 1
35+
36+
print(f"\u2705 {skill}: {len(data)} test case(s) valid")
37+
38+
if errors:
39+
print(f"\n{errors} error(s) found.")
40+
sys.exit(1)

0 commit comments

Comments
 (0)