Skip to main content

Middleware

Trait Middleware 

Source
pub trait Middleware: Send + Sync {
    // Provided methods
    fn on_user_message<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _ctx: &'life1 mut UserMessageCtx,
    ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait { ... }
    fn on_pre_llm<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _ctx: &'life1 mut PreLlmCtx,
    ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait { ... }
    fn on_post_llm<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _ctx: &'life1 mut PostLlmCtx,
    ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait { ... }
}

Provided Methods§

Source

fn on_user_message<'life0, 'life1, 'async_trait>( &'life0 self, _ctx: &'life1 mut UserMessageCtx, ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn on_pre_llm<'life0, 'life1, 'async_trait>( &'life0 self, _ctx: &'life1 mut PreLlmCtx, ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn on_post_llm<'life0, 'life1, 'async_trait>( &'life0 self, _ctx: &'life1 mut PostLlmCtx, ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§