Trait Provider

Source
pub trait Provider:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &'static str;
    fn complete<'life0, 'async_trait>(
        &'life0 self,
        model: Model,
        messages: Vec<Message>,
        system: Option<String>,
        tools: Option<Vec<ToolSchema>>,
        token: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, ApiError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: '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, 'async_trait>( &'life0 self, model: Model, messages: Vec<Message>, system: Option<String>, tools: Option<Vec<ToolSchema>>, token: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, ApiError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: '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§