pub struct Prompt {
pub system: Option<String>,
pub user: String,
}
pub struct TuningResult {
pub optimised_prompt: Prompt,
pub score: f32,
pub iterations: usize,
}
pub trait TuningEvaluator: Send + Sync {
type Error: std::error::Error + Send + Sync + 'static;
fn evaluate(&self, prompt: &Prompt, examples: &[(&str, &str)]) -> Result<f32, Self::Error>;
}
pub trait TuningStrategy: Send + Sync {
type Error: std::error::Error + Send + Sync + 'static;
fn name(&self) -> &'static str;
fn tune(
&self,
prompt: Prompt,
evaluator: &dyn TuningEvaluator<Error = Self::Error>,
) -> Result<TuningResult, Self::Error>;
}