evalrouter 0.3.7__tar.gz → 0.3.8__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.
- {evalrouter-0.3.7 → evalrouter-0.3.8}/PKG-INFO +74 -2
- {evalrouter-0.3.7 → evalrouter-0.3.8}/README.md +73 -1
- {evalrouter-0.3.7 → evalrouter-0.3.8}/pyproject.toml +1 -1
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/evalrouter_contracts/__init__.py +1 -1
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/__init__.py +6 -1
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/_account.py +110 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/_comparison.py +29 -5
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/_guided.py +731 -23
- evalrouter-0.3.8/src/kimpton_evalrouter/_read_cache.py +399 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/_resources.py +86 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/cli.py +1315 -69
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/render/live.py +8 -7
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/types.py +292 -1
- {evalrouter-0.3.7 → evalrouter-0.3.8}/LICENSE +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/evalrouter_contracts/bundle.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/evalrouter_contracts/components.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/evalrouter_contracts/models.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/evalrouter_contracts/protocol.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/evalrouter_contracts/py.typed +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/evalrouter_contracts/templates.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/evalrouter_contracts/validation.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/__main__.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/_artifacts.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/_boundary.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/_comparison_html.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/_helpers.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/_listing.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/_transport.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/langsmith.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/py.typed +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/render/__init__.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/render/_console.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/render/_theme.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/render/_widgets.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/render/picker.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/render/screens.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/render/tables.py +0 -0
- {evalrouter-0.3.7 → evalrouter-0.3.8}/src/kimpton_evalrouter/tracing.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: evalrouter
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.8
|
|
4
4
|
Summary: Typed Kimpton evaluation client and command-line interface
|
|
5
5
|
License-Expression: LicenseRef-Kimpton-EvalRouter-SDK
|
|
6
6
|
License-File: LICENSE
|
|
@@ -116,6 +116,59 @@ with the previous run of the same benchmark and model; that takes a few more
|
|
|
116
116
|
requests, so plain `results` does not. Watching a run survives brief API
|
|
117
117
|
outages such as a 503 during a deployment.
|
|
118
118
|
|
|
119
|
+
## Resume a stopped run
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
evalrouter resume RUN_ID --dry-run
|
|
123
|
+
evalrouter resume RUN_ID
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
When a run stops early, for example because it reached its spending cap,
|
|
127
|
+
`resume` quotes a new run that covers the same tasks. Tasks the original run
|
|
128
|
+
already graded are reused at $0, with no model request and no fee; only the
|
|
129
|
+
remaining tasks are rerun and charged, within a new cap. The quote shows the
|
|
130
|
+
source run, how many tasks are reused and rerun, which are left out and why,
|
|
131
|
+
the worst case, the cap, and when the reusable evidence and the quote expire.
|
|
132
|
+
Only a yes (or `--yes`) starts paid work; `--dry-run` never does. Without a
|
|
133
|
+
terminal, pass both `--yes` and `--max-cost USD`. A running run is only
|
|
134
|
+
watched. The original run and its results are never changed.
|
|
135
|
+
|
|
136
|
+
The accepted quote and its key are saved locally before submission, so
|
|
137
|
+
repeating the command after a dropped connection, or after adding credit when
|
|
138
|
+
the account was short, submits the same quote and cannot start a second run.
|
|
139
|
+
An expired quote is replaced by a fresh one, which must be confirmed again if
|
|
140
|
+
its cap differs. Repeating it with a different `--max-cost` or
|
|
141
|
+
`--include-cancelled` choice gets a fresh quote instead; if the earlier
|
|
142
|
+
submission already started a run, that run is shown and its scope stays as
|
|
143
|
+
accepted. A run can be resumed once: `resume` on a run that was already
|
|
144
|
+
resumed follows it to the newest run of that chain. A newest run that is still
|
|
145
|
+
running is watched; a finished one is quoted and asked about again, even with
|
|
146
|
+
`--yes`, and scripts are refused with its ID (`continuation_exists`, exit 2).
|
|
147
|
+
Tasks stopped by cancellation or the time limit are rerun only with
|
|
148
|
+
`--include-cancelled`.
|
|
149
|
+
|
|
150
|
+
Every task a quote leaves out, whether refused, cancelled without
|
|
151
|
+
`--include-cancelled`, or with a charge or provider outcome that is unresolved,
|
|
152
|
+
is excluded for good once you resume: neither that run nor any later resume of
|
|
153
|
+
it will run the task, and nothing brings it back automatically. The quote says
|
|
154
|
+
so whenever it leaves tasks out. At a terminal you are always asked, even with
|
|
155
|
+
`--yes`, and when cancelled tasks are left out you can get a new quote that
|
|
156
|
+
includes them instead. Without a terminal, such a resume also needs
|
|
157
|
+
`--accept-left-out`; otherwise it is refused (`confirmation_required`, exit 2)
|
|
158
|
+
and nothing is charged.
|
|
159
|
+
|
|
160
|
+
Resume supports one model, one benchmark and one attempt per task on the
|
|
161
|
+
reviewed native benchmark families (Inspect, SOB text and lm-eval) without a
|
|
162
|
+
judge model, within the source run's evidence retention and on the same
|
|
163
|
+
EvalRouter deployment. Comparisons, several benchmarks or attempts, judge-graded
|
|
164
|
+
benchmarks, repository agents and your own benchmarks are refused rather than
|
|
165
|
+
rerun. Graded tasks from runs that finished before resume evidence was recorded,
|
|
166
|
+
including existing runs, cannot gain that evidence later, and results are
|
|
167
|
+
never reused across EvalRouter deployments: after a deployment, those tasks are
|
|
168
|
+
refused rather than reused or rerun. Tasks whose earlier charge or provider
|
|
169
|
+
outcome is unresolved are left out and never retried. A server without resume
|
|
170
|
+
says so, and nothing is quoted or charged.
|
|
171
|
+
|
|
119
172
|
## Lists
|
|
120
173
|
|
|
121
174
|
`catalog`, `catalog --models`, `status`, `connections list` and `workspace list`
|
|
@@ -142,6 +195,21 @@ evalrouter catalog --slug BENCHMARK_SLUG --json
|
|
|
142
195
|
Choose a profile whose `quote_availability.status` is `ready_for_quote` and a
|
|
143
196
|
compatible managed model route from those responses. An active catalog entry
|
|
144
197
|
alone does not mean it is ready to run.
|
|
198
|
+
|
|
199
|
+
These three catalog reads are public, so the CLI sends them without your
|
|
200
|
+
credentials: they never read the keychain or refresh a sign-in. If the API
|
|
201
|
+
explicitly allows it (`Cache-Control` with `max-age`, and no `no-store`,
|
|
202
|
+
`no-cache` or `private`), the CLI keeps a local copy for at most five minutes
|
|
203
|
+
and says so on stderr when it uses one. `--refresh` reads the catalog now,
|
|
204
|
+
asking caches along the way to revalidate, and fails rather than show an older copy, and `--offline` uses only a fresh local
|
|
205
|
+
copy with no network. When a server marks a response `no-store`, the command still makes a request
|
|
206
|
+
and no offline copy is retained. Availability shown from a copy is informational: a quote always
|
|
207
|
+
checks it again. Workspace data, run status, results, quotes, credits and signed
|
|
208
|
+
URLs are never cached. The copy lives in `$XDG_CACHE_HOME/evalrouter` (or
|
|
209
|
+
`~/.cache/evalrouter`; `%LOCALAPPDATA%\evalrouter\cache` on Windows, or
|
|
210
|
+
`EVALROUTER_CACHE_DIR`), may be deleted at any time, and
|
|
211
|
+
`EVALROUTER_READ_CACHE=off` disables it.
|
|
212
|
+
|
|
145
213
|
Save this as `quote.json`, replacing both uppercase identifiers:
|
|
146
214
|
|
|
147
215
|
```json
|
|
@@ -219,9 +287,13 @@ intervals or winner are computed. `--output NAME.json` puts the sources in
|
|
|
219
287
|
## Supported commands
|
|
220
288
|
|
|
221
289
|
`catalog` (`--models`, `--slug` or `--environment`), `connections list/create/check/update/disable`,
|
|
222
|
-
`quote`, `run`, `status`, `wait`, `cancel`, `results`, `export`, `compare` and `open`.
|
|
290
|
+
`quote`, `run`, `resume`, `status`, `wait`, `cancel`, `results`, `export`, `compare` and `open`.
|
|
223
291
|
Repository qualification uses `agent-builds options/preview/create/list/status/cancel`.
|
|
224
292
|
Authoring your own benchmark package uses `benchmark init/validate/bundle`.
|
|
293
|
+
`credits` shows the workspace balance, the amount held by running evaluations
|
|
294
|
+
and what is available for new ones. It works with an `evalrouter login` sign-in
|
|
295
|
+
or an API key with the `billing:read` scope. Credit is added on the website under
|
|
296
|
+
Settings > Billing; the CLI never takes a payment.
|
|
225
297
|
Run each command with `--help` for exact flags. A connected model's credential
|
|
226
298
|
is never a command argument: `connections create` asks with hidden input in a
|
|
227
299
|
terminal, and scripts use `--key-stdin` or `--key-env NAME`
|
|
@@ -96,6 +96,59 @@ with the previous run of the same benchmark and model; that takes a few more
|
|
|
96
96
|
requests, so plain `results` does not. Watching a run survives brief API
|
|
97
97
|
outages such as a 503 during a deployment.
|
|
98
98
|
|
|
99
|
+
## Resume a stopped run
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
evalrouter resume RUN_ID --dry-run
|
|
103
|
+
evalrouter resume RUN_ID
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
When a run stops early, for example because it reached its spending cap,
|
|
107
|
+
`resume` quotes a new run that covers the same tasks. Tasks the original run
|
|
108
|
+
already graded are reused at $0, with no model request and no fee; only the
|
|
109
|
+
remaining tasks are rerun and charged, within a new cap. The quote shows the
|
|
110
|
+
source run, how many tasks are reused and rerun, which are left out and why,
|
|
111
|
+
the worst case, the cap, and when the reusable evidence and the quote expire.
|
|
112
|
+
Only a yes (or `--yes`) starts paid work; `--dry-run` never does. Without a
|
|
113
|
+
terminal, pass both `--yes` and `--max-cost USD`. A running run is only
|
|
114
|
+
watched. The original run and its results are never changed.
|
|
115
|
+
|
|
116
|
+
The accepted quote and its key are saved locally before submission, so
|
|
117
|
+
repeating the command after a dropped connection, or after adding credit when
|
|
118
|
+
the account was short, submits the same quote and cannot start a second run.
|
|
119
|
+
An expired quote is replaced by a fresh one, which must be confirmed again if
|
|
120
|
+
its cap differs. Repeating it with a different `--max-cost` or
|
|
121
|
+
`--include-cancelled` choice gets a fresh quote instead; if the earlier
|
|
122
|
+
submission already started a run, that run is shown and its scope stays as
|
|
123
|
+
accepted. A run can be resumed once: `resume` on a run that was already
|
|
124
|
+
resumed follows it to the newest run of that chain. A newest run that is still
|
|
125
|
+
running is watched; a finished one is quoted and asked about again, even with
|
|
126
|
+
`--yes`, and scripts are refused with its ID (`continuation_exists`, exit 2).
|
|
127
|
+
Tasks stopped by cancellation or the time limit are rerun only with
|
|
128
|
+
`--include-cancelled`.
|
|
129
|
+
|
|
130
|
+
Every task a quote leaves out, whether refused, cancelled without
|
|
131
|
+
`--include-cancelled`, or with a charge or provider outcome that is unresolved,
|
|
132
|
+
is excluded for good once you resume: neither that run nor any later resume of
|
|
133
|
+
it will run the task, and nothing brings it back automatically. The quote says
|
|
134
|
+
so whenever it leaves tasks out. At a terminal you are always asked, even with
|
|
135
|
+
`--yes`, and when cancelled tasks are left out you can get a new quote that
|
|
136
|
+
includes them instead. Without a terminal, such a resume also needs
|
|
137
|
+
`--accept-left-out`; otherwise it is refused (`confirmation_required`, exit 2)
|
|
138
|
+
and nothing is charged.
|
|
139
|
+
|
|
140
|
+
Resume supports one model, one benchmark and one attempt per task on the
|
|
141
|
+
reviewed native benchmark families (Inspect, SOB text and lm-eval) without a
|
|
142
|
+
judge model, within the source run's evidence retention and on the same
|
|
143
|
+
EvalRouter deployment. Comparisons, several benchmarks or attempts, judge-graded
|
|
144
|
+
benchmarks, repository agents and your own benchmarks are refused rather than
|
|
145
|
+
rerun. Graded tasks from runs that finished before resume evidence was recorded,
|
|
146
|
+
including existing runs, cannot gain that evidence later, and results are
|
|
147
|
+
never reused across EvalRouter deployments: after a deployment, those tasks are
|
|
148
|
+
refused rather than reused or rerun. Tasks whose earlier charge or provider
|
|
149
|
+
outcome is unresolved are left out and never retried. A server without resume
|
|
150
|
+
says so, and nothing is quoted or charged.
|
|
151
|
+
|
|
99
152
|
## Lists
|
|
100
153
|
|
|
101
154
|
`catalog`, `catalog --models`, `status`, `connections list` and `workspace list`
|
|
@@ -122,6 +175,21 @@ evalrouter catalog --slug BENCHMARK_SLUG --json
|
|
|
122
175
|
Choose a profile whose `quote_availability.status` is `ready_for_quote` and a
|
|
123
176
|
compatible managed model route from those responses. An active catalog entry
|
|
124
177
|
alone does not mean it is ready to run.
|
|
178
|
+
|
|
179
|
+
These three catalog reads are public, so the CLI sends them without your
|
|
180
|
+
credentials: they never read the keychain or refresh a sign-in. If the API
|
|
181
|
+
explicitly allows it (`Cache-Control` with `max-age`, and no `no-store`,
|
|
182
|
+
`no-cache` or `private`), the CLI keeps a local copy for at most five minutes
|
|
183
|
+
and says so on stderr when it uses one. `--refresh` reads the catalog now,
|
|
184
|
+
asking caches along the way to revalidate, and fails rather than show an older copy, and `--offline` uses only a fresh local
|
|
185
|
+
copy with no network. When a server marks a response `no-store`, the command still makes a request
|
|
186
|
+
and no offline copy is retained. Availability shown from a copy is informational: a quote always
|
|
187
|
+
checks it again. Workspace data, run status, results, quotes, credits and signed
|
|
188
|
+
URLs are never cached. The copy lives in `$XDG_CACHE_HOME/evalrouter` (or
|
|
189
|
+
`~/.cache/evalrouter`; `%LOCALAPPDATA%\evalrouter\cache` on Windows, or
|
|
190
|
+
`EVALROUTER_CACHE_DIR`), may be deleted at any time, and
|
|
191
|
+
`EVALROUTER_READ_CACHE=off` disables it.
|
|
192
|
+
|
|
125
193
|
Save this as `quote.json`, replacing both uppercase identifiers:
|
|
126
194
|
|
|
127
195
|
```json
|
|
@@ -199,9 +267,13 @@ intervals or winner are computed. `--output NAME.json` puts the sources in
|
|
|
199
267
|
## Supported commands
|
|
200
268
|
|
|
201
269
|
`catalog` (`--models`, `--slug` or `--environment`), `connections list/create/check/update/disable`,
|
|
202
|
-
`quote`, `run`, `status`, `wait`, `cancel`, `results`, `export`, `compare` and `open`.
|
|
270
|
+
`quote`, `run`, `resume`, `status`, `wait`, `cancel`, `results`, `export`, `compare` and `open`.
|
|
203
271
|
Repository qualification uses `agent-builds options/preview/create/list/status/cancel`.
|
|
204
272
|
Authoring your own benchmark package uses `benchmark init/validate/bundle`.
|
|
273
|
+
`credits` shows the workspace balance, the amount held by running evaluations
|
|
274
|
+
and what is available for new ones. It works with an `evalrouter login` sign-in
|
|
275
|
+
or an API key with the `billing:read` scope. Credit is added on the website under
|
|
276
|
+
Settings > Billing; the CLI never takes a payment.
|
|
205
277
|
Run each command with `--help` for exact flags. A connected model's credential
|
|
206
278
|
is never a command argument: `connections create` asks with hidden input in a
|
|
207
279
|
terminal, and scripts use `--key-stdin` or `--key-env NAME`
|
|
@@ -13,6 +13,7 @@ from ._resources import Evals as _Evals
|
|
|
13
13
|
from ._resources import Evaluations as _Evaluations
|
|
14
14
|
from ._resources import Protocols as _Protocols
|
|
15
15
|
from ._resources import Quotes as _Quotes
|
|
16
|
+
from ._resources import Regrades as _Regrades
|
|
16
17
|
from ._resources import Runs as _Runs
|
|
17
18
|
from ._transport import APIError, ClientError, RequestOptions, RequestTimeout, WaitCancelled
|
|
18
19
|
from ._transport import Transport as _Transport
|
|
@@ -27,7 +28,7 @@ __all__ = [
|
|
|
27
28
|
"WaitCancelled",
|
|
28
29
|
"types",
|
|
29
30
|
]
|
|
30
|
-
__version__ = "0.3.
|
|
31
|
+
__version__ = "0.3.8"
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
class Client(_Transport):
|
|
@@ -71,6 +72,10 @@ class Client(_Transport):
|
|
|
71
72
|
def runs(self) -> _Runs:
|
|
72
73
|
return _Runs(self)
|
|
73
74
|
|
|
75
|
+
@_cached_property
|
|
76
|
+
def regrades(self) -> _Regrades:
|
|
77
|
+
return _Regrades(self)
|
|
78
|
+
|
|
74
79
|
@_cached_property
|
|
75
80
|
def evals(self) -> _Evals:
|
|
76
81
|
return _Evals(self)
|
|
@@ -2059,5 +2059,115 @@ def human(command: str, action: str | None, value: dict) -> list[str]:
|
|
|
2059
2059
|
return lines
|
|
2060
2060
|
|
|
2061
2061
|
|
|
2062
|
+
# --- credits ---------------------------------------------------------------------
|
|
2063
|
+
#
|
|
2064
|
+
# `evalrouter credits` reads GET /v1/billing/wallet fresh on every call (never
|
|
2065
|
+
# cached; see docs/CLI-READ-CONSISTENCY.md). Credit is added only on the website:
|
|
2066
|
+
# the CLI prints the billing page and never opens a browser or starts a payment.
|
|
2067
|
+
|
|
2068
|
+
WALLET_PATH = "/billing/wallet"
|
|
2069
|
+
BILLING_PAGE = "/settings/billing"
|
|
2070
|
+
CREDIT_CODES = frozenset({"insufficient_credit", "wallet_negative"})
|
|
2071
|
+
|
|
2072
|
+
|
|
2073
|
+
def billing_url(base: str | None) -> str | None:
|
|
2074
|
+
"""The website billing page for a known hosted API; None for any other server."""
|
|
2075
|
+
website = CONNECT_WEBSITES.get(urlsplit(base).netloc) if base else None
|
|
2076
|
+
return website + BILLING_PAGE if website else None
|
|
2077
|
+
|
|
2078
|
+
|
|
2079
|
+
def add_credit_text(base: str | None) -> str:
|
|
2080
|
+
url = billing_url(base)
|
|
2081
|
+
return (
|
|
2082
|
+
f"Add credit at {url}"
|
|
2083
|
+
if url
|
|
2084
|
+
else "Add credit on the EvalRouter website under Settings > Billing"
|
|
2085
|
+
)
|
|
2086
|
+
|
|
2087
|
+
|
|
2088
|
+
def signed_money(value: object) -> str:
|
|
2089
|
+
"""Wire micro-USD as `$W.FF`, keeping a minus sign (a wallet can be below zero)."""
|
|
2090
|
+
from .render import format_money
|
|
2091
|
+
|
|
2092
|
+
if isinstance(value, str) and value.startswith("-") and value[1:].isdecimal():
|
|
2093
|
+
text = format_money(value[1:])
|
|
2094
|
+
return "unknown" if text == "unknown" else "-" + text
|
|
2095
|
+
return format_money(value)
|
|
2096
|
+
|
|
2097
|
+
|
|
2098
|
+
def _micro(value: object) -> int | None:
|
|
2099
|
+
if isinstance(value, str) and value.lstrip("-").isascii() and value.lstrip("-").isdecimal():
|
|
2100
|
+
return int(value)
|
|
2101
|
+
return None
|
|
2102
|
+
|
|
2103
|
+
|
|
2104
|
+
def credits_lines(value: dict, base: str | None) -> list[str]:
|
|
2105
|
+
"""Terminal projection of the wallet; `--json` prints the document unchanged."""
|
|
2106
|
+
rows = [
|
|
2107
|
+
("Balance", signed_money(value.get("balance_microusd")), ""),
|
|
2108
|
+
("Held", signed_money(value.get("reserved_microusd")), "reserved for running evaluations"),
|
|
2109
|
+
("Available", signed_money(value.get("available_microusd")), "for new evaluations"),
|
|
2110
|
+
]
|
|
2111
|
+
width = max(len(label) for label, _, _ in rows) + 1
|
|
2112
|
+
amount = max(len(text) for _, text, _ in rows)
|
|
2113
|
+
lines = ["Workspace credits"]
|
|
2114
|
+
for label, text, note in rows:
|
|
2115
|
+
lines.append(f" {label + ':':<{width}} {text:>{amount}}" + (f" {note}" if note else ""))
|
|
2116
|
+
balance, available = (
|
|
2117
|
+
_micro(value.get(key)) for key in ("balance_microusd", "available_microusd")
|
|
2118
|
+
)
|
|
2119
|
+
if balance is not None and balance < 0:
|
|
2120
|
+
lines.append(
|
|
2121
|
+
"The balance is below zero, so new evaluations cannot start until you add credit."
|
|
2122
|
+
)
|
|
2123
|
+
elif available is not None and available <= 0:
|
|
2124
|
+
lines.append("No credit is available for new evaluations.")
|
|
2125
|
+
lines.append(
|
|
2126
|
+
"Each run reserves its spending cap. Unused credit returns after its charges settle."
|
|
2127
|
+
)
|
|
2128
|
+
if value.get("purchases_enabled") is True:
|
|
2129
|
+
lines.append(add_credit_text(base) + ".")
|
|
2130
|
+
elif value.get("purchases_enabled") is False:
|
|
2131
|
+
lines.append("Credit purchases are not available for this workspace right now.")
|
|
2132
|
+
if value.get("payment_mode") == "test":
|
|
2133
|
+
lines.append("Test environment: purchases use test payments and are not charged.")
|
|
2134
|
+
return lines
|
|
2135
|
+
|
|
2136
|
+
|
|
2137
|
+
def credits_error(error: ClientError, base: str | None) -> None:
|
|
2138
|
+
"""Customer guidance for a wallet read this credential may not make.
|
|
2139
|
+
|
|
2140
|
+
A device sign-in registered before sign-ins could read credits is told
|
|
2141
|
+
(by the server's ``renew_sign_in``) to sign in once more; that registers a
|
|
2142
|
+
new grant with the read. An API key without billing:read keeps key advice.
|
|
2143
|
+
"""
|
|
2144
|
+
if not (isinstance(error, APIError) and error.code == "insufficient_scope"):
|
|
2145
|
+
return
|
|
2146
|
+
url = billing_url(base)
|
|
2147
|
+
where = f"at {url}" if url else "on the EvalRouter website under Settings > Billing"
|
|
2148
|
+
details = error.details if isinstance(error.details, dict) else {}
|
|
2149
|
+
if details.get("renew_sign_in") is True:
|
|
2150
|
+
error.message = (
|
|
2151
|
+
"This device signed in before sign-ins could read the credit balance. "
|
|
2152
|
+
f"Run `evalrouter login` once to renew it, or see your balance {where}."
|
|
2153
|
+
)
|
|
2154
|
+
return
|
|
2155
|
+
error.message = (
|
|
2156
|
+
"This sign-in cannot read the credit balance. See your balance and add credit "
|
|
2157
|
+
f"{where}, or use a workspace API key with the billing:read scope in EVALROUTER_API_KEY."
|
|
2158
|
+
)
|
|
2159
|
+
|
|
2160
|
+
|
|
2161
|
+
def credit_hint(error: ClientError, base: str | None) -> str | None:
|
|
2162
|
+
"""The next step after a funding refusal (402); None for any other error.
|
|
2163
|
+
|
|
2164
|
+
Only the website adds credit, and the command is run again afterwards. A
|
|
2165
|
+
budget-stopped run cannot be continued yet, so nothing suggests that.
|
|
2166
|
+
"""
|
|
2167
|
+
if not (isinstance(error, APIError) and error.status == 402 and error.code in CREDIT_CODES):
|
|
2168
|
+
return None
|
|
2169
|
+
return f"{add_credit_text(base)}, then run the command again. Nothing was charged for this request."
|
|
2170
|
+
|
|
2171
|
+
|
|
2062
2172
|
def file_mode(path: Path) -> int:
|
|
2063
2173
|
return stat.S_IMODE(path.stat().st_mode)
|
|
@@ -635,11 +635,35 @@ def differences(entries: list[dict], *, require_raw: bool) -> list[dict]:
|
|
|
635
635
|
"Attempts per task differ.",
|
|
636
636
|
lambda n: ((n.get("outcome_axes") or {}).get("model") or {}).get("attempts_per_task"),
|
|
637
637
|
)
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
638
|
+
# An unstarted or errored row may never have reached a grader. Its missing
|
|
639
|
+
# version is a coverage gap, not evidence that a different grader was used.
|
|
640
|
+
grader_versions: dict[str, set[str]] = {}
|
|
641
|
+
for entry in entries:
|
|
642
|
+
missing_version = False
|
|
643
|
+
for sample in entry["samples"]:
|
|
644
|
+
if sample["status"] != "graded":
|
|
645
|
+
continue
|
|
646
|
+
version = sample["grader_version"]
|
|
647
|
+
if not version:
|
|
648
|
+
missing_version = True
|
|
649
|
+
else:
|
|
650
|
+
grader_versions.setdefault(str(sample["profile_id"]), set()).add(str(version))
|
|
651
|
+
if missing_version:
|
|
652
|
+
warnings.append(
|
|
653
|
+
{
|
|
654
|
+
"code": "grader_version_missing",
|
|
655
|
+
"run_id": entry["run_id"],
|
|
656
|
+
"detail": "Some graded rows have no recorded grader version; "
|
|
657
|
+
"grader consistency cannot be verified.",
|
|
658
|
+
}
|
|
659
|
+
)
|
|
660
|
+
if any(len(versions) > 1 for versions in grader_versions.values()):
|
|
661
|
+
warnings.append(
|
|
662
|
+
{
|
|
663
|
+
"code": "grader_version_differs",
|
|
664
|
+
"detail": "Recorded grader versions differ for the same benchmark profile.",
|
|
665
|
+
}
|
|
666
|
+
)
|
|
643
667
|
differ(
|
|
644
668
|
"scored_tasks_differ",
|
|
645
669
|
"The graded task sets differ; each run's values use its own graded rows.",
|