Four tools served over MCP, twelve prompts, LangChain4j 1.24.0 OllamaChatModel, a scorer that validates each call against the tool's own JSON schema, and scripts to run and summarise the benchmark. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b3obqqePfZ9m2Jk5Ub
17 lines
1.2 KiB
Python
Executable File
17 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""ENVEL = the subset of SCHEMA that is an envelope-wrapped call ({"type":"function","function":..,"parameters":{..}} sent as the arguments).
|
|
Reads results/*.jsonl (written by Benchmark) and prints one summary table. Pure counting, no model involved."""
|
|
import glob, json, collections, sys
|
|
|
|
ORDER = ["VALID", "HALLUCINATED_TOOL", "SCHEMA_INVALID", "WRONG_TOOL", "WRONG_VALUE", "PARTIAL", "NO_CALL", "SPURIOUS_CALL"]
|
|
HEAD = ["VALID", "HALLU", "SCHEMA", "WTOOL", "WVAL", "PART", "NOCALL", "SPUR"]
|
|
files = sorted(glob.glob((sys.argv[1] if len(sys.argv) > 1 else "results") + "/*.jsonl"))
|
|
print(f"{'model':<14} {'n':>3} " + " ".join(f"{h:>6}" for h in HEAD) + f" {'ENVEL':>6} {'JSONtx':>6} {'s/call':>7}")
|
|
for f in files:
|
|
rows = [json.loads(l) for l in open(f)]
|
|
c = collections.Counter(r["outcome"] for r in rows)
|
|
env = sum(1 for r in rows if r["outcome"] == "SCHEMA_INVALID" and any("unknown argument 'parameters'" in n or "unknown argument 'function'" in n for n in r["notes"]))
|
|
jt = sum(1 for r in rows if r["jsonInText"])
|
|
sec = sum(r["ms"] for r in rows) / len(rows) / 1000
|
|
print(f"{rows[0]['model']:<14} {len(rows):>3} " + " ".join(f"{c.get(o, 0):>6}" for o in ORDER) + f" {env:>6} {jt:>6} {sec:>7.1f}")
|