Skip to main content

Provider

Trait Provider 

Source
pub trait Provider: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn model(&self) -> &str;
    fn set_model(&mut self, model: String);
    fn available_models(&self) -> Vec<String>;
    fn context_window(&self) -> u32;
    fn fetch_context_window(
        &self,
    ) -> Pin<Box<dyn Future<Output = Result<u32>> + Send + '_>>;
    fn fetch_models(
        &self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + '_>>;
    fn stream(
        &self,
        messages: &[Message],
        system: Option<&str>,
        tools: &[ToolDefinition],
        max_tokens: u32,
        thinking_budget: u32,
    ) -> Pin<Box<dyn Future<Output = Result<UnboundedReceiver<StreamEvent>>> + Send + '_>>;

    // Provided methods
    fn supports_server_compaction(&self) -> bool { ... }
    fn supports_vision(&self) -> bool { ... }
    fn stream_with_model(
        &self,
        model: &str,
        messages: &[Message],
        system: Option<&str>,
        tools: &[ToolDefinition],
        max_tokens: u32,
        thinking_budget: u32,
    ) -> Pin<Box<dyn Future<Output = Result<UnboundedReceiver<StreamEvent>>> + Send + '_>> { ... }
}

Required Methods§

Source

fn name(&self) -> &str

Source

fn model(&self) -> &str

Source

fn set_model(&mut self, model: String)

Source

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

Source

fn context_window(&self) -> u32

Source

fn fetch_context_window( &self, ) -> Pin<Box<dyn Future<Output = Result<u32>> + Send + '_>>

Source

fn fetch_models( &self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + '_>>

Source

fn stream( &self, messages: &[Message], system: Option<&str>, tools: &[ToolDefinition], max_tokens: u32, thinking_budget: u32, ) -> Pin<Box<dyn Future<Output = Result<UnboundedReceiver<StreamEvent>>> + Send + '_>>

Provided Methods§

Source

fn supports_server_compaction(&self) -> bool

Source

fn supports_vision(&self) -> bool

Source

fn stream_with_model( &self, model: &str, messages: &[Message], system: Option<&str>, tools: &[ToolDefinition], max_tokens: u32, thinking_budget: u32, ) -> Pin<Box<dyn Future<Output = Result<UnboundedReceiver<StreamEvent>>> + Send + '_>>

Implementors§