#[non_exhaustive]pub struct MultiRunReport {
pub eval_set_id: String,
pub requested_runs: usize,
pub min_pass_rate: f64,
pub cases: Vec<CaseRunSummary>,
pub runs: Vec<EvaluationReport>,
pub stopped: Option<String>,
pub started_at: DateTime<Utc>,
pub duration: Duration,
}Expand description
The result of running an eval set several times.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.eval_set_id: StringThe eval set’s id.
requested_runs: usizeRuns requested.
min_pass_rate: f64Fraction of runs a case must pass.
cases: Vec<CaseRunSummary>One summary per case, in the order the cases first appeared.
runs: Vec<EvaluationReport>The report of every completed run, in order.
stopped: Option<String>Why the runs stopped before requested_runs completed: a budget, spend cap or kill
switch refusal. The run it interrupted is not counted.
started_at: DateTime<Utc>When the first run started.
duration: DurationWall time of every completed run.
Implementations§
Source§impl MultiRunReport
impl MultiRunReport
Sourcepub fn from_runs(
eval_set_id: &str,
requested_runs: usize,
min_pass_rate: f64,
runs: Vec<EvaluationReport>,
) -> Self
pub fn from_runs( eval_set_id: &str, requested_runs: usize, min_pass_rate: f64, runs: Vec<EvaluationReport>, ) -> Self
Summarises the reports of completed runs of one eval set.
A case passes when it passed in at least min_pass_rate of the runs it ran in. A
case that errored in a run counts as failing that run.
§Example
use std::collections::HashMap;
use std::time::Duration;
use adk_eval::{EvaluationReport, EvaluationResult, MultiRunReport};
let run = |passed: bool| {
let scores = HashMap::from([("response_similarity".to_string(), if passed { 1.0 } else { 0.4 })]);
let result = if passed {
EvaluationResult::passed("weather", scores, Duration::ZERO)
} else {
EvaluationResult::failed("weather", scores, vec![], Duration::ZERO)
};
EvaluationReport::new("run", vec![result], chrono::Utc::now())
};
let report = MultiRunReport::from_runs("weather", 3, 1.0, vec![run(true), run(false), run(true)]);
let case = &report.cases[0];
assert_eq!((case.passed_runs, case.runs, case.flaky, case.passed), (2, 3, true, false));
assert!(!report.all_passed());Sourcepub fn with_stopped(self, reason: impl Into<String>) -> Self
pub fn with_stopped(self, reason: impl Into<String>) -> Self
Records why the runs stopped early.
Sourcepub fn completed_runs(&self) -> usize
pub fn completed_runs(&self) -> usize
Runs that completed.
Sourcepub fn all_passed(&self) -> bool
pub fn all_passed(&self) -> bool
true when every requested run completed and every case reached the minimum pass
rate.
Sourcepub fn flaky_cases(&self) -> impl Iterator<Item = &CaseRunSummary>
pub fn flaky_cases(&self) -> impl Iterator<Item = &CaseRunSummary>
The cases that passed in some runs and failed in others.
Sourcepub fn baseline_metrics(&self) -> HashMap<String, HashMap<String, f64>>
pub fn baseline_metrics(&self) -> HashMap<String, HashMap<String, f64>>
Metric name → case id → value, the shape BaselineStore
stores: the mean score of every criterion and the case’s PASS_RATE_METRIC.
Sourcepub fn case_results(&self) -> Vec<EvaluationResult>
pub fn case_results(&self) -> Vec<EvaluationResult>
One result per case for reporters that take an EvaluationReport, such as the
JUnit reporter: it passes when the case reached the minimum pass rate, carries the
mean scores and the pass rate, and fails with a pass_rate failure otherwise.
Sourcepub fn format_summary(&self) -> String
pub fn format_summary(&self) -> String
A human-readable summary: one line per case with its pass rate, then the score statistics of each criterion.