Skip to main content

ChatEngineBackendPlugin

Trait ChatEngineBackendPlugin 

Source
pub trait ChatEngineBackendPlugin: Send + Sync {
    // Required method
    fn plugin_instance_id(&self) -> &str;

    // Provided methods
    fn on_session_type_configured<'life0, 'async_trait>(
        &'life0 self,
        _ctx: SessionPluginCtx,
    ) -> Pin<Box<dyn Future<Output = Result<SessionPluginResponse, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn on_session_created<'life0, 'async_trait>(
        &'life0 self,
        _ctx: SessionPluginCtx,
    ) -> Pin<Box<dyn Future<Output = Result<SessionPluginResponse, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn on_session_updated<'life0, 'async_trait>(
        &'life0 self,
        _ctx: SessionPluginCtx,
    ) -> Pin<Box<dyn Future<Output = Result<SessionPluginResponse, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn on_message<'life0, 'async_trait>(
        &'life0 self,
        _ctx: MessagePluginCtx,
    ) -> Pin<Box<dyn Future<Output = Result<PluginStream, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn on_message_recreate<'life0, 'async_trait>(
        &'life0 self,
        _ctx: MessagePluginCtx,
    ) -> Pin<Box<dyn Future<Output = Result<PluginStream, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn on_session_summary<'life0, 'async_trait>(
        &'life0 self,
        _ctx: SessionPluginCtx,
    ) -> Pin<Box<dyn Future<Output = Result<PluginStream, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<HealthStatus, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

Provided Methods§

Source

fn on_session_type_configured<'life0, 'async_trait>( &'life0 self, _ctx: SessionPluginCtx, ) -> Pin<Box<dyn Future<Output = Result<SessionPluginResponse, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn on_session_created<'life0, 'async_trait>( &'life0 self, _ctx: SessionPluginCtx, ) -> Pin<Box<dyn Future<Output = Result<SessionPluginResponse, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn on_session_updated<'life0, 'async_trait>( &'life0 self, _ctx: SessionPluginCtx, ) -> Pin<Box<dyn Future<Output = Result<SessionPluginResponse, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn on_message<'life0, 'async_trait>( &'life0 self, _ctx: MessagePluginCtx, ) -> Pin<Box<dyn Future<Output = Result<PluginStream, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Process a new user message and stream response events back.

The outer Result reports failures before streaming starts (e.g., auth failure). Once a stream is returned, individual items may be Err to signal mid-stream failures (e.g., upstream disconnect).

The returned PluginStream must be 'static — it cannot borrow from &self. See PluginStream’s docs for the idiomatic way to detach captured state (clone fields out, or hold self in an Arc).

Source

fn on_message_recreate<'life0, 'async_trait>( &'life0 self, _ctx: MessagePluginCtx, ) -> Pin<Box<dyn Future<Output = Result<PluginStream, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Regenerate a response for an existing user message (new variant).

Same streaming semantics as on_message.

Source

fn on_session_summary<'life0, 'async_trait>( &'life0 self, _ctx: SessionPluginCtx, ) -> Pin<Box<dyn Future<Output = Result<PluginStream, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Generate a session summary and stream the result back.

Summary plugins typically emit one or more Chunk events followed by a Complete event carrying metadata.

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HealthStatus, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§