pub struct EvalHarness { /* private fields */ }Expand description
Evaluation harness for comparing prompt strategies.
Implementations§
Source§impl EvalHarness
impl EvalHarness
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new harness with EvalMetric::ExactMatch as the primary metric.
Sourcepub fn with_metric(metric: EvalMetric) -> Self
pub fn with_metric(metric: EvalMetric) -> Self
Create a harness with a custom primary metric.
Sourcepub fn run_eval(
&self,
strategy_name: &str,
responses: Vec<(String, u64, f64)>,
) -> EvalReport
pub fn run_eval( &self, strategy_name: &str, responses: Vec<(String, u64, f64)>, ) -> EvalReport
Run an evaluation for strategy_name.
responses must be in the same order as cases were added. Each element
is (response_text, latency_ms, cost_usd).
§Panics
Does not panic — if responses is shorter than cases, remaining cases
are skipped.
Sourcepub fn score(&self, response: &str, case: &EvalCase, metric: &EvalMetric) -> f64
pub fn score(&self, response: &str, case: &EvalCase, metric: &EvalMetric) -> f64
Score a single response against a case using the supplied metric.
Sourcepub fn compare_strategies(reports: &[EvalReport]) -> Vec<(&EvalReport, f64)>
pub fn compare_strategies(reports: &[EvalReport]) -> Vec<(&EvalReport, f64)>
Rank strategies by composite score: pass_rate * 0.6 - avg_cost_usd_norm * 0.2 - avg_latency_norm * 0.2.
Returns references to reports in descending composite score order.
Sourcepub fn filter_by_tag(&self, tag: &str) -> Vec<&EvalCase>
pub fn filter_by_tag(&self, tag: &str) -> Vec<&EvalCase>
Return all cases tagged with tag.
Sourcepub fn difficulty_breakdown(&self, report: &EvalReport) -> HashMap<u8, f64>
pub fn difficulty_breakdown(&self, report: &EvalReport) -> HashMap<u8, f64>
Compute per-difficulty pass rate from a report.
Keys are difficulty levels (1–5); values are pass rates (0.0 – 1.0).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EvalHarness
impl RefUnwindSafe for EvalHarness
impl Send for EvalHarness
impl Sync for EvalHarness
impl Unpin for EvalHarness
impl UnsafeUnpin for EvalHarness
impl UnwindSafe for EvalHarness
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request