Skip to main content

OutputValidator

Trait OutputValidator 

Source
pub trait OutputValidator: Send + Sync {
    // Required method
    fn validate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        state: &'life1 mut AgentRunState,
        output: &'life2 OutputValue,
    ) -> Pin<Box<dyn Future<Output = OutputValidationResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Validator for parsed structured output values.

Required Methods§

Source

fn validate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, state: &'life1 mut AgentRunState, output: &'life2 OutputValue, ) -> Pin<Box<dyn Future<Output = OutputValidationResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Validate a parsed output value.

§Errors

Returns an error when validation fails or should trigger a model retry.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F, Fut> OutputValidator for FunctionOutputValidator<F>
where F: Send + Sync + Fn(&mut AgentRunState, &OutputValue) -> Fut, Fut: Send + Future<Output = OutputValidationResult<()>>,