margin-referee 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: margin-referee
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Should you switch models? Replay your own eval set on a candidate and get a verdict that holds up.
5
5
  License: MIT
6
6
  Keywords: llm,evals,model-selection,agents,promptfoo,langfuse,braintrust
@@ -1,2 +1,2 @@
1
1
  """margin-referee: should you switch models? Ask your own eval set."""
2
- __version__ = "0.1.0"
2
+ __version__ = "0.1.1"
@@ -132,9 +132,14 @@ def verdict(res: Result, candidates: int = 1) -> dict:
132
132
  why = (f"{len(res.unanswered)} case(s) got no gradable answer" if res.unanswered
133
133
  else res.stopped) + ", so the comparison is incomplete"
134
134
  elif not pb.supported:
135
- why = (f"with {k} models tried on these {n} cases it needs about "
136
- f"{stats.gate_floor(k)}; confirm it alone on fresh cases" if n < stats.gate_floor(k)
137
- else f"the quality bound is {pb.upper:.1%} behind, the bar allows {pb.margin:.1%}")
135
+ need = stats.gate_floor(k)
136
+ if n < need and k == 1:
137
+ why = f"{n} cases are too few to prove a switch: it needs about {need}"
138
+ elif n < need:
139
+ why = (f"with {k} models tried on these cases, the best needs about {need}; "
140
+ "confirm it alone on fresh cases")
141
+ else:
142
+ why = f"the quality bound is {pb.upper:.1%} behind, the bar allows {pb.margin:.1%}"
138
143
  else:
139
144
  why = "the candidate costs more per case: an upgrade, not a saving"
140
145
  return {"cases": n, "baseline_passed": int(sum(b for _, b, _ in res.pairs)),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: margin-referee
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Should you switch models? Replay your own eval set on a candidate and get a verdict that holds up.
5
5
  License: MIT
6
6
  Keywords: llm,evals,model-selection,agents,promptfoo,langfuse,braintrust
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "margin-referee"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  description = "Should you switch models? Replay your own eval set on a candidate and get a verdict that holds up."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -71,3 +71,10 @@ def test_fit_reports_ready_or_not(tmp_path, capsys):
71
71
  assert cli.main(["fit", str(f)]) == 2
72
72
  out = json.loads(capsys.readouterr().out)
73
73
  assert out["graded"] == 50 and out["needed"] == 111 and not out["ready"]
74
+
75
+
76
+ def test_the_reason_fits_the_number_of_candidates():
77
+ res = replay.run(_cases(5), _fake([1] * 5, 0.01), _fake([1] * 5, 0.001), cap_usd=1, workers=1)
78
+ why = replay.verdict(res, 1)["why"]
79
+ assert why == "5 cases are too few to prove a switch: it needs about 100"
80
+ assert "confirm it alone on fresh cases" in replay.verdict(res, 3)["why"]
File without changes
File without changes
File without changes