Provider

Trait Provider 

Source
pub trait Provider:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &'static str;
    fn complete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        model_id: &'life1 ModelId,
        messages: Vec<Message>,
        system: Option<String>,
        tools: Option<Vec<ToolSchema>>,
        call_options: Option<ModelParameters>,
        token: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, ApiError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn create_auth_flow(
        &self,
        _storage: Arc<dyn AuthStorage>,
    ) -> Option<Box<dyn DynAuthenticationFlow>> { ... }
}
Expand description

Provider trait that all LLM providers must implement

Required Methods§

Source

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

Get the name of the provider

Source

fn complete<'life0, 'life1, 'async_trait>( &'life0 self, model_id: &'life1 ModelId, messages: Vec<Message>, system: Option<String>, tools: Option<Vec<ToolSchema>>, call_options: Option<ModelParameters>, token: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Complete a prompt with the LLM

Provided Methods§

Source

fn create_auth_flow( &self, _storage: Arc<dyn AuthStorage>, ) -> Option<Box<dyn DynAuthenticationFlow>>

Create an authentication flow for this provider Returns None if the provider doesn’t support authentication

Implementors§