Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/maint-78-model-evaluation-pilot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ jobs:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
CLAUDE_API_STRANSKE: ${{ secrets.CLAUDE_API_STRANSKE }}
run: |
uv run --extra dev python -m tools.run_model_eval_pilot --output pilot-results.json
uv run --extra dev --extra langchain \
python -m tools.run_model_eval_pilot --output pilot-results.json
Comment thread
stranske marked this conversation as resolved.
Resolved
- name: Summarize pilot
if: always()
run: |
Expand Down
14 changes: 13 additions & 1 deletion tests/tools/test_run_model_eval_pilot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from types import SimpleNamespace

from tools.run_model_eval_pilot import run_pilot
from tools.run_model_eval_pilot import run_pilot, unusable_candidates


def test_run_pilot_records_paired_verdicts() -> None:
Expand Down Expand Up @@ -77,3 +77,15 @@ def test_run_pilot_captures_failure_with_case_and_candidate_metadata() -> None:
"error": "fetch failed",
}
]


def test_unusable_candidates_requires_valid_evidence_per_candidate() -> None:
report = {
"results": [
{"provider": "openai", "model_id": "working", "schema_valid": True},
{"provider": "openai", "model_id": "working", "schema_valid": False},
{"provider": "anthropic", "model_id": "broken", "schema_valid": False},
]
}

assert unusable_candidates(report) == ["anthropic/broken"]
1 change: 1 addition & 0 deletions tests/workflows/test_model_eval_pilot_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def test_model_eval_pilot_runs_as_importable_module() -> None:
upload = next(step for step in steps if "actions/upload-artifact@" in step.get("uses", ""))

assert pilot["run"].count("python -m tools.run_model_eval_pilot") == 1
assert pilot["run"].count("--extra langchain") == 1
assert "python tools/run_model_eval_pilot.py" not in pilot["run"]
assert summary["if"] == "always()"
assert "if [ ! -f pilot-results.json ]" in summary["run"]
Expand Down
19 changes: 19 additions & 0 deletions tools/run_model_eval_pilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import argparse
import json
import os
import sys
import time
from collections.abc import Callable
from pathlib import Path
Expand Down Expand Up @@ -75,6 +76,17 @@ def run_pilot(
}


def unusable_candidates(report: dict[str, Any]) -> list[str]:
"""Return candidates that produced no schema-valid evaluation row."""
health: dict[tuple[str, str], bool] = {}
for row in report.get("results", []):
if not isinstance(row, dict):
continue
key = (str(row.get("provider", "")), str(row.get("model_id", "")))
health[key] = health.get(key, False) or row.get("schema_valid") is True
return [f"{provider}/{model}" for (provider, model), usable in health.items() if not usable]


def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--corpus", type=Path, default=ROOT / "config/model_eval_pilot.json")
Expand All @@ -92,6 +104,13 @@ def main() -> int:
token=token,
)
args.output.write_text(json.dumps(payload, indent=2) + "\n")
unusable = unusable_candidates(payload)
if unusable:
print(
"pilot error: candidates produced no schema-valid rows: " + ", ".join(unusable),
file=sys.stderr,
)
return 1
return 0
Comment thread
stranske marked this conversation as resolved.
Resolved


Expand Down
Loading