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§
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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,
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.