schemacast.bench.run¶
Run the corpus through a model, or the oracle, and score every episode.
Attributes¶
ClientFactory = Callable[[BenchCase, SchemaCastSettings, PickScripts], LLMClient]
module-attribute
¶
PRICES_ENV = 'SCHEMACAST_BENCH_PRICES'
module-attribute
¶
PickScripts = dict[str, str]
module-attribute
¶
RECAST_CACHE_SUBDIR = 'recast'
module-attribute
¶
Classes¶
BenchReport
¶
Bases: BaseModel
A benchmark run.
Source code in schemacast/bench/run.py
Attributes¶
corpus_digest
instance-attribute
¶
corpus_dir = Field(default=None, description='A corpus outside the package (``--corpus``): never publishable.')
class-attribute
instance-attribute
¶
corpus_modified = Field(description='The cases differ from the pinned digest: not publishable.')
class-attribute
instance-attribute
¶
corpus_version = CORPUS_VERSION
class-attribute
instance-attribute
¶
graflo_version = Field(default_factory=lambda: version('graflo'))
class-attribute
instance-attribute
¶
prices_source = None
class-attribute
instance-attribute
¶
publishable
property
¶
rows
instance-attribute
¶
schemacast_version = __version__
class-attribute
instance-attribute
¶
split
instance-attribute
¶
started
instance-attribute
¶
CaseRecord
¶
Bases: BaseModel
One case's episodes and their sum.
Source code in schemacast/bench/run.py
Attributes¶
counts
instance-attribute
¶
digest = Field(default=None, description="The case's content digest; absent before corpus 1.1.0.")
class-attribute
instance-attribute
¶
episodes
instance-attribute
¶
family
instance-attribute
¶
instance
instance-attribute
¶
name
instance-attribute
¶
split
instance-attribute
¶
EpisodeRecord
¶
Bases: BaseModel
One episode's outcome: enough to pair two runs episode by episode.
Source code in schemacast/bench/run.py
Row
¶
Bases: BaseModel
Every selected case cast by one model.
Source code in schemacast/bench/run.py
Attributes¶
cases
instance-attribute
¶
counts
property
¶
label
instance-attribute
¶
model = Field(description='Model settings that reach the provider.')
class-attribute
instance-attribute
¶
saved = Field(default=False, description='Scored from saved casts: the first reply, the slice, tokens, re-casts and picks are not measured.')
class-attribute
instance-attribute
¶
unmatched_casts = Field(default_factory=list, description='Source ids of saved casts with no episode in the corpus; ignored.')
class-attribute
instance-attribute
¶
usd = Field(default=None, description='List price of the tokens used, billed or replayed; None without a price for this model.')
class-attribute
instance-attribute
¶
Functions:¶
case_settings(case, base)
¶
base with the settings case pins.
load_prices(path=None)
¶
The price table and its _source note; empty when none is configured.
Source code in schemacast/bench/run.py
model_clients(settings)
¶
Clients for the configured model, one cache per settings.
Source code in schemacast/bench/run.py
new_report(split, started, rows, prices_source, corpus=None)
¶
A report over rows, stamped with the corpus it ran against: the
bundled one, or the one under corpus (cases/ and schemas/).
Source code in schemacast/bench/run.py
oracle_clients()
¶
Oracle clients, scripted per case.
Source code in schemacast/bench/run.py
pick_item(outcome, episode, spec, refs, schema)
¶
The pick input for a cast episode's staged mentions the case gives candidates for, and the expected key per mention ref.
Source code in schemacast/bench/run.py
price(counts, entry)
¶
USD for counts' tokens at entry's rates.
Source code in schemacast/bench/run.py
recast_settings(base)
¶
base with its own cache directory, so the second cast makes a fresh call.
Source code in schemacast/bench/run.py
run_case(case, settings, clients, *, concurrency=8)
async
¶
Cast and score every episode of case.
Raises:
| Type | Description |
|---|---|
LLMConfigurationError
|
the deployment is misconfigured. |
CacheMissError
|
a miss while the cache requires hits. |
Source code in schemacast/bench/run.py
run_row(cases, settings, *, oracle=False, concurrency=8, prices=None)
async
¶
One row: every case cast by the configured model, or by the oracle.