Skip to main content

Provider

Trait Provider 

Source
pub trait Provider:
    Send
    + Sync
    + Debug {
    // Required methods
    fn complete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        req: &'life1 ModelRequest,
        auth: &'life2 Auth,
    ) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn id(&self) -> &str;
}
Expand description

A normalized model backend. Implementations translate ModelRequest/ModelResponse to/from one wire API.

Required Methods§

Source

fn complete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, req: &'life1 ModelRequest, auth: &'life2 Auth, ) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Call the model and normalize the result.

§Errors

Returns ProviderError on transport failure, a non-2xx response, or a response that doesn’t decode into the expected shape.

Source

fn id(&self) -> &str

Provider identity, e.g. "anthropic".

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§