Skip to main content

Model

Trait Model 

Source
pub trait Model: Send + Sync {
    // Required method
    fn complete<'life0, 'async_trait>(
        &'life0 self,
        request: ModelRequest,
    ) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ModelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Object-safe boundary for provider-neutral model requests.

ModelClient implements this trait so applications can select supported providers dynamically without exposing provider backends or raw generation.

Required Methods§

Source

fn complete<'life0, 'async_trait>( &'life0 self, request: ModelRequest, ) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ModelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Completes one model request.

§Errors

Returns ModelError when the provider request fails or its response cannot be converted to the provider-neutral response.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§