HfClientPort

Trait HfClientPort 

Source
pub trait HfClientPort: Send + Sync {
    // Required methods
    fn search<'life0, 'life1, 'async_trait>(
        &'life0 self,
        options: &'life1 HfSearchOptions,
    ) -> Pin<Box<dyn Future<Output = HfPortResult<HfSearchResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_quantizations<'life0, 'life1, 'async_trait>(
        &'life0 self,
        model_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = HfPortResult<Vec<HfQuantInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_gguf_files<'life0, 'life1, 'async_trait>(
        &'life0 self,
        model_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = HfPortResult<Vec<HfFileInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_quantization_files<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        model_id: &'life1 str,
        quantization: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = HfPortResult<Vec<(String, u64)>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_commit_sha<'life0, 'life1, 'async_trait>(
        &'life0 self,
        model_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = HfPortResult<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_model_info<'life0, 'life1, 'async_trait>(
        &'life0 self,
        model_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = HfPortResult<HfRepoInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Port trait for HuggingFace Hub operations.

This trait defines the interface that the core domain uses to interact with HuggingFace. The implementation lives in gglib-hf.

§Design

  • Uses core-owned DTOs, not HuggingFace API types
  • Returns HfPortError for all failures
  • Async methods for network operations
  • No implementation details leak through this interface

Required Methods§

Source

fn search<'life0, 'life1, 'async_trait>( &'life0 self, options: &'life1 HfSearchOptions, ) -> Pin<Box<dyn Future<Output = HfPortResult<HfSearchResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Search for GGUF models on HuggingFace.

Source

fn list_quantizations<'life0, 'life1, 'async_trait>( &'life0 self, model_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = HfPortResult<Vec<HfQuantInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List available quantizations for a model.

§Arguments
  • model_id - Full model ID (e.g., TheBloke/Llama-2-7B-GGUF)
Source

fn list_gguf_files<'life0, 'life1, 'async_trait>( &'life0 self, model_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = HfPortResult<Vec<HfFileInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List all GGUF files in a model repository.

§Arguments
  • model_id - Full model ID
Source

fn get_quantization_files<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, model_id: &'life1 str, quantization: &'life2 str, ) -> Pin<Box<dyn Future<Output = HfPortResult<Vec<(String, u64)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get files for a specific quantization.

Returns (path, size) tuples for all files in the quantization, sorted for correct shard ordering.

§Arguments
  • model_id - Full model ID
  • quantization - Quantization name (e.g., Q4_K_M)
Source

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

Get the current commit SHA for a model.

Used for version tracking and update detection.

Source

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

Get detailed information about a model.

Implementors§