Expand description
Evaluation harness — domain model + scorers (foundation layer).
Defines eval cases/suites/scores/results and a Scorer contract with
rule-based scorers. This module performs no IO and runs nothing on its own;
the suite loader, runner, persistence, and CLI surface are separate changes.
Re-exports§
pub use targeted::ContextEfficiencyProvider;pub use targeted::RoutingProvider;pub use targeted::SkillActivationProvider;
Modules§
- cli
- Eval harness CLI surface (EH5).
- targeted
- Targeted eval providers (CH-17): skill-activation accuracy, routing accuracy, and context-strategy efficiency.
Structs§
- Contains
- 1.0 when
outputcontains the case’sexpectedsubstring, else 0.0. - Eval
Case - A single evaluation case: an input and an optional expected output.
- Eval
Result - The scores for one case in a run (persisted to a file by EH4).
- Eval
Suite - A named collection of eval cases (loaded from a golden suite file by EH2).
- Exact
Match - 1.0 when
outputequals the case’sexpected, else 0.0 (0.0 if no expected). - Json
Valid - 1.0 when
outputparses as valid JSON, else 0.0. - LlmJudge
- An LLM-as-judge scorer. Holds the provider it calls (captured at
construction) since
Scorer::scoreonly receives(case, output). - NonEmpty
- 1.0 when
outputis non-empty after trimming, else 0.0. - Pattern
Match - Literal substring/anchor match (no
regexdependency — covers the common contains/format checks; a true-regex scorer is a later option). - Regression
Entry - One scorer’s regression verdict vs a baseline.
- Regression
Report - The full regression report for a run vs its baseline.
- Runner
- Runs an
EvalSuitethrough aCompletionProviderand scores each case. - Score
- A normalized score in the range 0.0–1.0 produced by a
Scorer. - Sycophancy
- Quality scorer: higher value = less sycophantic (
1.0 - sycophancy_score), derived from the existing rule-based sycophancy detector. Uses a default detector config so eval scoring is independent of runtime gating.
Enums§
- Pattern
Mode - How a
PatternMatchmatches its literalpatternagainst the output. - Scorer
Spec - A declarative scorer entry in a suite file. Serde-tagged by
type(snake_case), e.g.{ "type": "pattern_match", "pattern": "ERROR", "mode": "starts_with" }.
Traits§
- Completion
Provider - Produces a model output for an eval case’s input. Implemented by the CLI over
Orchestrator::chat_non_streaming; stubbed in tests. - Scorer
- Maps a
(case, output)pair to a normalizedScore.
Functions§
- build_
scorers - Build the scorers for a suite: its declared
ScorerSpecs, or — when it declares none — the default set fromdefault_scorers.providerbacks anyllm_judgescorers. - compare
- Compare a current summary to a baseline. A scorer regresses when its mean
drops below the baseline by more than
threshold. With no baseline entry for a scorer, it is not a regression (a run can establish a baseline). - default_
scorers - Default scorer set when a suite declares none: quality scorers always, plus
expected-based scorers when every case carries an
expectedoutput. - load_
baseline - Load a suite’s baseline summary, or
Noneif it does not exist. - load_
suite - Load an
EvalSuitefrom a golden file, choosing the parser by extension (.json,.yaml,.yml). Returns an error (never panics) on a missing file, an unparseable body, or an unknown extension. - save_
baseline - Save a suite’s baseline summary, creating
dirif needed. - save_
results - Write a run’s results to
<dir>/<suite>-<ts>.json, creatingdirif needed. - summarize
- Mean score per scorer across all results in a run.
Type Aliases§
- Score
Summary - Per-scorer mean score (0.0–1.0) over a run.
BTreeMapfor deterministic order.