ModelRegistrarPort

Trait ModelRegistrarPort 

Source
pub trait ModelRegistrarPort: Send + Sync {
    // Required methods
    fn register_model<'life0, 'life1, 'async_trait>(
        &'life0 self,
        download: &'life1 CompletedDownload,
    ) -> Pin<Box<dyn Future<Output = Result<Model, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn register_model_from_path<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        repo_id: &'life1 str,
        commit_sha: &'life2 str,
        file_path: &'life3 Path,
        quantization: &'life4 str,
    ) -> Pin<Box<dyn Future<Output = Result<Model, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
}
Expand description

Port for registering downloaded models in the database.

This trait is implemented by core services and injected into the download manager, allowing model registration without coupling to AppCore directly.

§Usage

let registrar: Arc<dyn ModelRegistrarPort> = /* ... */;
let download = CompletedDownload { ... };
let model = registrar.register_model(&download).await?;

Required Methods§

Source

fn register_model<'life0, 'life1, 'async_trait>( &'life0 self, download: &'life1 CompletedDownload, ) -> Pin<Box<dyn Future<Output = Result<Model, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Register a downloaded model in the database.

Parses GGUF metadata from the downloaded file and creates a database entry. For sharded models, the primary (first shard) path is used for registration.

§Arguments
  • download - The completed download information
§Returns

Returns the created Model on success.

Source

fn register_model_from_path<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, repo_id: &'life1 str, commit_sha: &'life2 str, file_path: &'life3 Path, quantization: &'life4 str, ) -> Pin<Box<dyn Future<Output = Result<Model, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Register a model using raw path parameters.

This is a simpler interface for cases where you have the file path but not the full download metadata.

§Arguments
  • repo_id - HuggingFace repository ID
  • commit_sha - Git commit SHA
  • file_path - Path to the GGUF file
  • quantization - Quantization type as string
§Returns

Returns the created Model on success.

Implementors§