Skip to main content

Sampler

Trait Sampler 

Source
pub trait Sampler: Send + Sync {
    // Required methods
    fn sample_training<'life0, 'async_trait>(
        &'life0 self,
        batch_size: usize,
    ) -> Pin<Box<dyn Future<Output = Result<EvalSample, OptimizerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn validation_set<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<EvalSample, OptimizerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn score<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        instruction: &'life1 str,
        model_id: &'life2 str,
        cases: &'life3 [EvalCase],
    ) -> Pin<Box<dyn Future<Output = Result<f64, OptimizerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

Trait for sampling evaluation examples during optimization.

Implementations provide training/validation splits and scoring.

Required Methods§

Source

fn sample_training<'life0, 'async_trait>( &'life0 self, batch_size: usize, ) -> Pin<Box<dyn Future<Output = Result<EvalSample, OptimizerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sample a batch of training examples.

Source

fn validation_set<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<EvalSample, OptimizerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the full validation set.

Source

fn score<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, instruction: &'life1 str, model_id: &'life2 str, cases: &'life3 [EvalCase], ) -> Pin<Box<dyn Future<Output = Result<f64, OptimizerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Score an agent instruction against a set of evaluation cases.

Returns a score between 0.0 and 1.0.

Implementors§