all the changes
This commit is contained in:
1 parent
94f30165f9
commit
f30adf05af
35 files changed
+2979
-1607
No files matched your search
@@ -4,8 +4,7 @@
|
||||
Usage: run_eval.py [--url http://127.0.0.1:5005] [--golden eval/golden.jsonl] [--json out.json]
|
||||
|
||||
Each golden row: {"id", "expected", "text"}; `expected` is a sidecar action name
|
||||
or "none" when no tool should fit. The sidecar has no fallback tool, so "none"
|
||||
rows measure how often it force-fits (see the confidence column).
|
||||
including "needs_review" for the fallback.
|
||||
"""
|
||||
import argparse, json, os, sys, time, urllib.request
|
||||
from collections import Counter, defaultdict
|
||||
@@ -29,7 +28,7 @@ def main():
|
||||
ap.add_argument("--golden", default=os.path.join(HERE, "golden.jsonl"))
|
||||
ap.add_argument("--json", help="write per-row results here")
|
||||
ap.add_argument("--min-conf", type=float, default=0.0,
|
||||
help="predictions below this confidence count as 'none'")
|
||||
help="predictions below this confidence count as needs_review")
|
||||
a = ap.parse_args()
|
||||
|
||||
rows = [json.loads(l) for l in open(a.golden) if l.strip()]
|
||||
@@ -41,10 +40,10 @@ def main():
|
||||
except Exception as e:
|
||||
print(f"sidecar error on {row['id']}: {e}", file=sys.stderr)
|
||||
sys.exit(2)
|
||||
pred = out.get("action", "unclassified")
|
||||
pred = out.get("action", "needs_review")
|
||||
conf = out.get("confidence", 0.0)
|
||||
if conf < a.min_conf or pred == "unclassified":
|
||||
pred = "none"
|
||||
if conf < a.min_conf:
|
||||
pred = "needs_review"
|
||||
lat.append(out.get("latency_ms", 0.0))
|
||||
confusion[(row["expected"], pred)] += 1
|
||||
results.append({**row, "predicted": pred, "confidence": conf, "ok": pred == row["expected"]})
|
||||
|
||||
Reference in new issue
Block a user