pub trait ModelProviderTrait: Send + Sync {
// Required methods
fn download_model<'life0, 'life1, 'async_trait>(
&'life0 self,
model_name: &'life1 str,
cache_path: Option<PathBuf>,
ignore_weights: bool,
) -> Pin<Box<dyn Future<Output = Result<PathBuf>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_model<'life0, 'life1, 'async_trait>(
&'life0 self,
model_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_model_path<'life0, 'life1, 'async_trait>(
&'life0 self,
model_name: &'life1 str,
cache_dir: PathBuf,
) -> Pin<Box<dyn Future<Output = Result<PathBuf>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn provider_name(&self) -> &'static str;
// Provided methods
fn is_ignored(filename: &str) -> bool
where Self: Sized { ... }
fn is_image(path: &Path) -> bool
where Self: Sized { ... }
fn is_weight_file(filename: &str) -> bool
where Self: Sized { ... }
}Expand description
Trait for model providers This trait provides the framework for supporting multiple model providers.
Required Methods§
Sourcefn download_model<'life0, 'life1, 'async_trait>(
&'life0 self,
model_name: &'life1 str,
cache_path: Option<PathBuf>,
ignore_weights: bool,
) -> Pin<Box<dyn Future<Output = Result<PathBuf>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn download_model<'life0, 'life1, 'async_trait>(
&'life0 self,
model_name: &'life1 str,
cache_path: Option<PathBuf>,
ignore_weights: bool,
) -> Pin<Box<dyn Future<Output = Result<PathBuf>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Download a model and return the path where it was downloaded
Sourcefn delete_model<'life0, 'life1, 'async_trait>(
&'life0 self,
model_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_model<'life0, 'life1, 'async_trait>(
&'life0 self,
model_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a model from the provider’s cache Returns Ok(()) if the model was successfully deleted or didn’t exist
Sourcefn get_model_path<'life0, 'life1, 'async_trait>(
&'life0 self,
model_name: &'life1 str,
cache_dir: PathBuf,
) -> Pin<Box<dyn Future<Output = Result<PathBuf>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_model_path<'life0, 'life1, 'async_trait>(
&'life0 self,
model_name: &'life1 str,
cache_dir: PathBuf,
) -> Pin<Box<dyn Future<Output = Result<PathBuf>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the full path to the latest model snapshot if it exists Returns the path if found, or an error if not found
Sourcefn provider_name(&self) -> &'static str
fn provider_name(&self) -> &'static str
Get the provider name for logging
Provided Methods§
Sourcefn is_ignored(filename: &str) -> boolwhere
Self: Sized,
fn is_ignored(filename: &str) -> boolwhere
Self: Sized,
Check if a file should be ignored during download This allows each provider to specify which files to skip Default implementation ignores common repository metadata files
Sourcefn is_image(path: &Path) -> boolwhere
Self: Sized,
fn is_image(path: &Path) -> boolwhere
Self: Sized,
Check if a file is an image file that should be ignored This allows each provider to customize image file detection Default implementation recognizes common image file extensions
Sourcefn is_weight_file(filename: &str) -> boolwhere
Self: Sized,
fn is_weight_file(filename: &str) -> boolwhere
Self: Sized,
Checks if a file is a model weight file