Skip to main content

Scorer

Trait Scorer 

Source
pub trait Scorer: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn score<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        case: &'life1 EvalCase,
        output: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Score> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Maps a (case, output) pair to a normalized Score.

Async so that LLM-as-judge scorers (a later change) fit without trait churn; rule-based scorers compute synchronously.

Required Methods§

Source

fn name(&self) -> &'static str

Stable scorer name (used as the Score.scorer label).

Source

fn score<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, case: &'life1 EvalCase, output: &'life2 str, ) -> Pin<Box<dyn Future<Output = Score> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Score output for case. Rule scorers are deterministic and do no IO.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§