Skip to main content

Provider

Trait Provider 

Source
pub trait Provider: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn supported_models(&self) -> Vec<String>;
    fn cli(&self) -> &'static dyn CliHandlers;
    fn handle_messages<'life0, 'async_trait>(
        &'life0 self,
        body: MessagesRequest,
        ctx: RequestContext,
    ) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn handle_count_tokens<'life0, 'async_trait>(
        &'life0 self,
        body: MessagesRequest,
        ctx: RequestContext,
    ) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn handle_messages_with_conversation_identity<'life0, 'async_trait>(
        &'life0 self,
        body: MessagesRequest,
        ctx: RequestContext,
        conversation_identity: Option<ConversationIdentity>,
    ) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn generate_anthropic_stream<'life0, 'async_trait>(
        &'life0 self,
        _body: MessagesRequest,
        _ctx: RequestContext,
    ) -> Pin<Box<dyn Future<Output = Result<Generation, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn supported_models(&self) -> Vec<String>

Source

fn cli(&self) -> &'static dyn CliHandlers

Source

fn handle_messages<'life0, 'async_trait>( &'life0 self, body: MessagesRequest, ctx: RequestContext, ) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn handle_count_tokens<'life0, 'async_trait>( &'life0 self, body: MessagesRequest, ctx: RequestContext, ) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn handle_messages_with_conversation_identity<'life0, 'async_trait>( &'life0 self, body: MessagesRequest, ctx: RequestContext, conversation_identity: Option<ConversationIdentity>, ) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn generate_anthropic_stream<'life0, 'async_trait>( &'life0 self, _body: MessagesRequest, _ctx: RequestContext, ) -> Pin<Box<dyn Future<Output = Result<Generation, ProviderError>> + 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§