Skip to main content

ModelProvider

Trait ModelProvider 

Source
pub trait ModelProvider: Send + Sync {
Show 17 methods // Required methods fn call_with_tools<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, messages: &'life1 [ChatMessage], tools: &'life2 [ToolDefinition], model_override: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<ProviderResponse, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn stream<'life0, 'life1, 'async_trait>( &'life0 self, messages: &'life1 [ChatMessage], tx: Sender<InferenceEvent>, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn detect_model<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn detect_context_length<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_model<'life0, 'life1, 'async_trait>( &'life0 self, model_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn load_model_with_context<'life0, 'life1, 'async_trait>( &'life0 self, model_id: &'life1 str, context_length: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn load_embedding_model<'life0, 'life1, 'async_trait>( &'life0 self, model_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_models<'life0, 'async_trait>( &'life0 self, kind: ProviderModelKind, loaded_only: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn unload_model<'life0, 'life1, 'async_trait>( &'life0 self, model_id: Option<&'life1 str>, all: bool, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn unload_embedding_model<'life0, 'life1, 'async_trait>( &'life0 self, model_id: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn prewarm<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_embedding_model<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn name(&self) -> &str; fn current_model(&self) -> String; fn context_length(&self) -> usize; fn set_runtime_profile(&mut self, model: &str, context_length: usize);
}

Required Methods§

Source

fn call_with_tools<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, messages: &'life1 [ChatMessage], tools: &'life2 [ToolDefinition], model_override: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<ProviderResponse, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source

fn stream<'life0, 'life1, 'async_trait>( &'life0 self, messages: &'life1 [ChatMessage], tx: Sender<InferenceEvent>, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn detect_model<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn detect_context_length<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn load_model<'life0, 'life1, 'async_trait>( &'life0 self, model_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn load_model_with_context<'life0, 'life1, 'async_trait>( &'life0 self, model_id: &'life1 str, context_length: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn load_embedding_model<'life0, 'life1, 'async_trait>( &'life0 self, model_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn list_models<'life0, 'async_trait>( &'life0 self, kind: ProviderModelKind, loaded_only: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn unload_model<'life0, 'life1, 'async_trait>( &'life0 self, model_id: Option<&'life1 str>, all: bool, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn unload_embedding_model<'life0, 'life1, 'async_trait>( &'life0 self, model_id: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn prewarm<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_embedding_model<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn name(&self) -> &str

Source

fn current_model(&self) -> String

Source

fn context_length(&self) -> usize

Source

fn set_runtime_profile(&mut self, model: &str, context_length: usize)

Implementors§