pub struct SimplePromptOptimizer { /* private fields */ }Expand description
Simple prompt optimizer that uses an LLM to iteratively rewrite instructions.
Process:
- Score the initial instruction on a training batch
- For each iteration, generate a candidate instruction using the optimizer LLM
- Score the candidate — keep it if it improves on the best score
- Validate the best instruction on the validation set
Implementations§
Trait Implementations§
Source§impl AgentOptimizer for SimplePromptOptimizer
impl AgentOptimizer for SimplePromptOptimizer
Source§fn optimize<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
initial_instruction: &'life1 str,
model_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<OptimizerResult, OptimizerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn optimize<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
initial_instruction: &'life1 str,
model_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<OptimizerResult, OptimizerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Run the optimization process. Read more
Auto Trait Implementations§
impl Freeze for SimplePromptOptimizer
impl !RefUnwindSafe for SimplePromptOptimizer
impl Send for SimplePromptOptimizer
impl Sync for SimplePromptOptimizer
impl Unpin for SimplePromptOptimizer
impl UnsafeUnpin for SimplePromptOptimizer
impl !UnwindSafe for SimplePromptOptimizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more