evalrouter 0.3.3__tar.gz → 0.3.4__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.
Files changed (32) hide show
  1. {evalrouter-0.3.3 → evalrouter-0.3.4}/PKG-INFO +7 -7
  2. {evalrouter-0.3.3 → evalrouter-0.3.4}/README.md +6 -6
  3. {evalrouter-0.3.3 → evalrouter-0.3.4}/pyproject.toml +1 -1
  4. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/evalrouter_contracts/__init__.py +1 -1
  5. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/__init__.py +1 -1
  6. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/_boundary.py +14 -1
  7. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/_guided.py +80 -2
  8. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/cli.py +902 -60
  9. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/render/live.py +31 -0
  10. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/render/screens.py +93 -6
  11. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/types.py +49 -2
  12. {evalrouter-0.3.3 → evalrouter-0.3.4}/LICENSE +0 -0
  13. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/evalrouter_contracts/bundle.py +0 -0
  14. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/evalrouter_contracts/components.py +0 -0
  15. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/evalrouter_contracts/models.py +0 -0
  16. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/evalrouter_contracts/protocol.py +0 -0
  17. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/evalrouter_contracts/py.typed +0 -0
  18. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/evalrouter_contracts/templates.py +0 -0
  19. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/evalrouter_contracts/validation.py +0 -0
  20. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/__main__.py +0 -0
  21. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/_account.py +0 -0
  22. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/_helpers.py +0 -0
  23. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/_listing.py +0 -0
  24. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/_resources.py +0 -0
  25. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/_transport.py +0 -0
  26. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/py.typed +0 -0
  27. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/render/__init__.py +0 -0
  28. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/render/_console.py +0 -0
  29. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/render/_theme.py +0 -0
  30. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/render/_widgets.py +0 -0
  31. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/render/picker.py +0 -0
  32. {evalrouter-0.3.3 → evalrouter-0.3.4}/src/kimpton_evalrouter/render/tables.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evalrouter
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: Typed Kimpton evaluation client and command-line interface
5
5
  License-Expression: LicenseRef-Kimpton-EvalRouter-SDK
6
6
  License-File: LICENSE
@@ -38,7 +38,8 @@ the `kimpton_evalrouter` import and every API are unchanged. To switch, run
38
38
  `pip uninstall -y kimpton-evalrouter-sdk evalrouter`) and install `evalrouter`.
39
39
 
40
40
  The package supplies the `evalrouter` command; no repository checkout is needed.
41
- Run the browser sign-in below to sign in or create your account.
41
+ [Create an EvalRouter account](https://evalrouter.ai/register), verify your email,
42
+ and follow the browser sign-in below.
42
43
  Package installation does not grant account access or evaluation credit.
43
44
 
44
45
  Sign in with your account:
@@ -48,9 +49,10 @@ evalrouter login
48
49
  evalrouter whoami
49
50
  ```
50
51
 
51
- The browser guides you through sign-up or sign-in, email verification and
52
- terminal approval. The CLI resumes automatically and selects your only workspace.
53
- Production is the default API, with `--base-url` available for other environments.
52
+ Approve the browser code. New accounts finish setup on the website; the CLI
53
+ continues when that is complete. It selects your only workspace automatically.
54
+ Production is the default API; `evalrouter options` lists `--base-url` and the other
55
+ settings that apply to every command.
54
56
  No API key or credential-storage setup is needed for a normal sign-in.
55
57
 
56
58
  CI and services can use `EVALROUTER_API_KEY` and `EVALROUTER_WORKSPACE_ID` supplied
@@ -275,5 +277,3 @@ Replace the coverage placeholder with the entire returned object; do not guess
275
277
  tasks, counts or seeds. Use the existing `quote`, `run`, `wait`, `results` and
276
278
  `export` commands above. Qualification and evaluation have separate caps and
277
279
  charges. A qualification pass does not submit an evaluation automatically.
278
-
279
- After confirming the terminal code, sign in if asked and keep the browser open until your device is connected. If the browser says the code is invalid, press Enter in the waiting terminal for a fresh code (or restart evalrouter login). Your account and workspace are preserved.
@@ -23,7 +23,8 @@ the `kimpton_evalrouter` import and every API are unchanged. To switch, run
23
23
  `pip uninstall -y kimpton-evalrouter-sdk evalrouter`) and install `evalrouter`.
24
24
 
25
25
  The package supplies the `evalrouter` command; no repository checkout is needed.
26
- Run the browser sign-in below to sign in or create your account.
26
+ [Create an EvalRouter account](https://evalrouter.ai/register), verify your email,
27
+ and follow the browser sign-in below.
27
28
  Package installation does not grant account access or evaluation credit.
28
29
 
29
30
  Sign in with your account:
@@ -33,9 +34,10 @@ evalrouter login
33
34
  evalrouter whoami
34
35
  ```
35
36
 
36
- The browser guides you through sign-up or sign-in, email verification and
37
- terminal approval. The CLI resumes automatically and selects your only workspace.
38
- Production is the default API, with `--base-url` available for other environments.
37
+ Approve the browser code. New accounts finish setup on the website; the CLI
38
+ continues when that is complete. It selects your only workspace automatically.
39
+ Production is the default API; `evalrouter options` lists `--base-url` and the other
40
+ settings that apply to every command.
39
41
  No API key or credential-storage setup is needed for a normal sign-in.
40
42
 
41
43
  CI and services can use `EVALROUTER_API_KEY` and `EVALROUTER_WORKSPACE_ID` supplied
@@ -260,5 +262,3 @@ Replace the coverage placeholder with the entire returned object; do not guess
260
262
  tasks, counts or seeds. Use the existing `quote`, `run`, `wait`, `results` and
261
263
  `export` commands above. Qualification and evaluation have separate caps and
262
264
  charges. A qualification pass does not submit an evaluation automatically.
263
-
264
- After confirming the terminal code, sign in if asked and keep the browser open until your device is connected. If the browser says the code is invalid, press Enter in the waiting terminal for a fresh code (or restart evalrouter login). Your account and workspace are preserved.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "evalrouter"
7
- version = "0.3.3"
7
+ version = "0.3.4"
8
8
  description = "Typed Kimpton evaluation client and command-line interface"
9
9
  readme = "README.md"
10
10
  license = "LicenseRef-Kimpton-EvalRouter-SDK"
@@ -8,4 +8,4 @@ computes digests and refuses invalid packages; it never imports contributed
8
8
  code, opens a network connection, signs anything or carries operator state.
9
9
  """
10
10
 
11
- __version__ = "0.3.3"
11
+ __version__ = "0.3.4"
@@ -26,7 +26,7 @@ __all__ = [
26
26
  "WaitCancelled",
27
27
  "types",
28
28
  ]
29
- __version__ = "0.3.3"
29
+ __version__ = "0.3.4"
30
30
 
31
31
 
32
32
  class Client(_Transport):
@@ -5,6 +5,9 @@ import re as _re
5
5
 
6
6
  from ._transport import ClientError
7
7
 
8
+ # Quote output formats (additive; the server resolves and freezes the choice).
9
+ OUTPUT_FORMATS = frozenset({"default", "leaderboard", "prompt_json", "native_json", "json_schema"})
10
+
8
11
 
9
12
  def validate_submission(resource, body):
10
13
  if resource == "agent_builds":
@@ -129,6 +132,16 @@ def validate_submission(resource, body):
129
132
  raise ClientError(
130
133
  "invalid_input", "Concurrency must be auto, max, or an integer from 1 to 100."
131
134
  )
135
+ if (
136
+ resource == "quotes"
137
+ and isinstance(body, dict)
138
+ and "output_format" in body
139
+ and body["output_format"] not in OUTPUT_FORMATS
140
+ ):
141
+ raise ClientError(
142
+ "invalid_input",
143
+ "Output format must be default, leaderboard, prompt_json, native_json or json_schema.",
144
+ )
132
145
  if resource == "quotes" and isinstance(body, dict) and "agent" in body:
133
146
  selection = body.get("selection")
134
147
  if (
@@ -145,7 +158,7 @@ def validate_submission(resource, body):
145
158
  )
146
159
  return body
147
160
  allowed = (
148
- {"selection", "model", "coverage", "max_charge_microusd", "concurrency"}
161
+ {"selection", "model", "coverage", "max_charge_microusd", "concurrency", "output_format"}
149
162
  if resource == "quotes"
150
163
  else {
151
164
  "model",
@@ -179,6 +179,7 @@ def add_run_arguments(run, concurrency_type) -> None:
179
179
  metavar="auto|max|1..100",
180
180
  help="Requested model-request ceiling for the new quote",
181
181
  )
182
+ add_format_argument(run)
182
183
  run.add_argument(
183
184
  "-y", "--yes", action="store_true", help="Start without asking (needs a cap off-terminal)"
184
185
  )
@@ -195,6 +196,23 @@ def add_run_arguments(run, concurrency_type) -> None:
195
196
  add_metrics_argument(run)
196
197
 
197
198
 
199
+ OUTPUT_FORMATS = ("default", "leaderboard", "prompt_json", "native_json", "json_schema")
200
+
201
+
202
+ def add_format_argument(parser) -> None:
203
+ """The output format for a benchmark version that declares selectable formats."""
204
+ parser.add_argument(
205
+ "--format",
206
+ dest="output_format",
207
+ choices=OUTPUT_FORMATS,
208
+ help=(
209
+ "Output format for versions that offer one (default: the version's default). "
210
+ "leaderboard runs native JSON and refuses a model without it; "
211
+ "results record the format and never mix formats"
212
+ ),
213
+ )
214
+
215
+
198
216
  def add_metrics_argument(parser) -> None:
199
217
  parser.add_argument(
200
218
  "--all-metrics",
@@ -227,6 +245,7 @@ def argument_conflict(args) -> str | None:
227
245
  ("--seed", args.seed),
228
246
  ("--max-cost", args.max_cost),
229
247
  ("--concurrency", args.concurrency),
248
+ ("--format", getattr(args, "output_format", None)),
230
249
  )
231
250
  if value not in (None, False)
232
251
  ]
@@ -714,6 +733,28 @@ def _version_record(client, slug: str, version: str | None) -> dict:
714
733
  )
715
734
 
716
735
 
736
+ #: A workspace-private benchmark created by `evalrouter benchmark create`.
737
+ PRIVATE_BENCHMARK = re.compile(
738
+ r"byob-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}@1"
739
+ )
740
+
741
+
742
+ def _private_record(client, term: str) -> dict:
743
+ value = client.request("GET", f"/private-benchmarks/{term}")
744
+ if not isinstance(value, dict) or value.get("id") != term:
745
+ raise ClientError("invalid_response", "The API returned another private benchmark.")
746
+ if value.get("status") != "active":
747
+ raise ClientError("benchmark_unavailable", f"{term} is archived and cannot start new runs.")
748
+ return {
749
+ "id": term,
750
+ "slug": term.split("@", 1)[0],
751
+ "version": "1",
752
+ "name": value.get("name"),
753
+ "task_count": value.get("row_count"),
754
+ "quote_availability": {"status": "ready_for_quote"},
755
+ }
756
+
757
+
717
758
  def resolve_benchmark(client, term: str | None, *, prompt: bool) -> dict:
718
759
  """One quotable benchmark profile record for a slug, name, `slug@version` or profile ID."""
719
760
  if not term and not prompt:
@@ -721,6 +762,9 @@ def resolve_benchmark(client, term: str | None, *, prompt: bool) -> dict:
721
762
  "benchmark_not_found",
722
763
  "Name a benchmark, for example: evalrouter run gpqa-diamond --model MODEL",
723
764
  )
765
+ if term and PRIVATE_BENCHMARK.fullmatch(term):
766
+ # Private benchmarks are never in the shared catalog listing.
767
+ return _private_record(client, term)
724
768
  if term and "@" in term:
725
769
  slug, _, version = term.partition("@")
726
770
  return _version_record(client, slug, version)
@@ -870,6 +914,21 @@ def _coverage_text(plan: dict) -> str:
870
914
  return text + (f", seed {seed}" if type(seed) is int else "")
871
915
 
872
916
 
917
+ def _format_text(plan: dict) -> str | None:
918
+ """The frozen output format(s) of a quote, when its versions declare one."""
919
+ selected = [
920
+ profile.get("output_format")
921
+ for profile in plan.get("profiles") or []
922
+ if isinstance(profile, dict) and isinstance(profile.get("output_format"), dict)
923
+ ]
924
+ names = list(dict.fromkeys(str(item.get("id")) for item in selected))
925
+ if not names:
926
+ return None
927
+ policies = {item.get("policy") for item in selected}
928
+ policy = "" if policies <= {"explicit", None} else f" ({', '.join(sorted(map(str, policies)))})"
929
+ return ", ".join(names) + policy
930
+
931
+
873
932
  def _concurrency_text(plan: dict) -> str | None:
874
933
  metadata = plan.get("concurrency")
875
934
  if not isinstance(metadata, dict):
@@ -950,7 +1009,14 @@ def parallel_note(quote: dict) -> str | None:
950
1009
  metadata = plan.get("concurrency") if isinstance(plan.get("concurrency"), dict) else None
951
1010
  if metadata is not None:
952
1011
  requested = metadata.get("requested")
953
- target = 4 if requested == "auto" else 100 if requested == "max" else requested
1012
+ # `auto` sizes itself from the route's latency (the admitted ceiling).
1013
+ target = (
1014
+ metadata.get("admitted_ceiling")
1015
+ if requested == "auto"
1016
+ else 100
1017
+ if requested == "max"
1018
+ else requested
1019
+ )
954
1020
  adapters = [
955
1021
  p.get("adapter_ceiling")
956
1022
  for p in metadata.get("profiles") or []
@@ -1021,7 +1087,14 @@ def quote_rows(
1021
1087
  ("Model", str(model or "unknown")),
1022
1088
  ("Coverage", _coverage_text(plan)),
1023
1089
  ]
1024
- if expected:
1090
+ quoted = render.screens.expected_costs(quote)
1091
+ if quoted is not None and (quoted[3] in {"measured", "planned"} or not expected):
1092
+ # The quote's own expected charge (measured usage) wins over the
1093
+ # derived figure from one earlier run.
1094
+ estimate, p50, p90, _ = quoted
1095
+ fmt = render.screens.format_cents
1096
+ rows.append(("Expected", f"~{fmt(estimate)} p50–p90 {fmt(p50)}–{fmt(p90)}"))
1097
+ elif expected:
1025
1098
  rows.append(
1026
1099
  (
1027
1100
  "Expected",
@@ -1062,6 +1135,9 @@ def quote_rows(
1062
1135
  concurrency = _concurrency_text(plan)
1063
1136
  if concurrency:
1064
1137
  rows.append(("Concurrency", concurrency))
1138
+ output_format = _format_text(plan)
1139
+ if output_format:
1140
+ rows.append(("Output format", output_format))
1065
1141
  rows.append(("Expires", _expires_text(quote.get("expires_at"))))
1066
1142
  return rows
1067
1143
 
@@ -1443,6 +1519,8 @@ def _request(client, args, prompt: bool) -> tuple[dict, dict]:
1443
1519
  }
1444
1520
  if args.concurrency is not None:
1445
1521
  request["concurrency"] = args.concurrency
1522
+ if getattr(args, "output_format", None) is not None:
1523
+ request["output_format"] = args.output_format
1446
1524
  labels = {"benchmark": benchmark_label(record), "slug": record.get("slug"), "model": model_text}
1447
1525
  return request, labels
1448
1526