Skip to main content

Model

Trait Model 

Source
pub trait Model:
    Send
    + Sync
    + 'static {
    // Required methods
    fn complete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 Context,
    ) -> Pin<Box<dyn Future<Output = Result<ModelOutput, ModelError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn info(&self) -> ModelInfo;

    // Provided method
    fn stream<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 Context,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<ModelDelta, ModelError>> + Send>>, ModelError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait { ... }
}

Required Methods§

Source

fn complete<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 Context, ) -> Pin<Box<dyn Future<Output = Result<ModelOutput, ModelError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn info(&self) -> ModelInfo

Provided Methods§

Source

fn stream<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 Context, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<ModelDelta, ModelError>> + Send>>, ModelError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Streaming is optional; default implementation falls back to complete.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§