Skip to main content

Module runner

Module runner 

Source
Expand description

Async Metric trait and EvalRunner execution engine.

§Example

use traitclaw_eval::runner::{AsyncMetric, EvalRunner};
use traitclaw_eval::{EvalSuite, TestCase};
use async_trait::async_trait;

struct AlwaysOne;

#[async_trait]
impl AsyncMetric for AlwaysOne {
    fn name(&self) -> &'static str { "always_one" }
    async fn score(&self, _input: &str, _output: &str, _kw: &[&str]) -> f64 { 1.0 }
}

let runner = EvalRunner::new().metric(Box::new(AlwaysOne)).threshold(0.8);

Structs§

EvalRunner
Evaluation runner — executes a suite against an agent using async metrics.
SyncMetricAdapter
Wraps a sync Metric impl as an AsyncMetric.

Traits§

AsyncMetric
Async trait for evaluation metrics.
EvalAgent
A callable async agent for use with EvalRunner.