Skip to main content

MultiRunReport

Struct MultiRunReport 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§eval_set_id: String

The eval set’s id.

§requested_runs: usize

Runs requested.

§min_pass_rate: f64

Fraction 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: Duration

Wall time of every completed run.

Implementations§

Source§

impl MultiRunReport

Source

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());
Source

pub fn with_stopped(self, reason: impl Into<String>) -> Self

Records why the runs stopped early.

Source

pub fn completed_runs(&self) -> usize

Runs that completed.

Source

pub fn all_passed(&self) -> bool

true when every requested run completed and every case reached the minimum pass rate.

Source

pub fn flaky_cases(&self) -> impl Iterator<Item = &CaseRunSummary>

The cases that passed in some runs and failed in others.

Source

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.

Source

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.

Source

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.

Source

pub fn to_json(&self) -> Result<String, Error>

Serializes the report as pretty-printed JSON.

§Errors

Returns an error when a score cannot be serialized.

Trait Implementations§

Source§

impl Clone for MultiRunReport

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MultiRunReport

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for MultiRunReport

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for MultiRunReport

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Forget for MultiRunReport

§

impl Freeze for MultiRunReport

§

impl Move for MultiRunReport

§

impl RefUnwindSafe for MultiRunReport

§

impl Send for MultiRunReport
where RawVecInner: Send, NodeRef<Owned, String, ScoreStats, LeafOrInternal>: Send, BoxRaw<(String, ScoreStats)>: Send, NodeRef<Owned, String, usize, LeafOrInternal>: Send, BoxRaw<(String, usize)>: Send, NonZero<i32>: Send, Utc: Send, RawTable<(String, f64)>: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send,

§

impl Sync for MultiRunReport
where RawVecInner: Sync, NodeRef<Owned, String, ScoreStats, LeafOrInternal>: Sync, BoxRaw<(String, ScoreStats)>: Sync, NodeRef<Owned, String, usize, LeafOrInternal>: Sync, BoxRaw<(String, usize)>: Sync, NonZero<i32>: Sync, Utc: Sync, RawTable<(String, f64)>: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync, NodeRef<Owned, String, String, LeafOrInternal>: Sync, BoxRaw<(String, String)>: Sync,

§

impl Unpin for MultiRunReport
where *const u8 is !null: Unpin, *const LeafNode<String, ScoreStats> is !null: Unpin, Box<(String, ScoreStats)>: Unpin, *const LeafNode<String, usize> is !null: Unpin, Box<(String, usize)>: Unpin, NonZero<i32>: Unpin, Utc: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin,

§

impl UnsafeUnpin for MultiRunReport

§

impl UnwindSafe for MultiRunReport

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more