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
HuggingFaceAPI types - Returns
HfPortErrorfor all failures - Async methods for network operations
- No implementation details leak through this interface
Required Methods§
Sourcefn 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 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.
Sourcefn 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_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)
Sourcefn 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 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,
Sourcefn 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_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 IDquantization- Quantization name (e.g.,Q4_K_M)
Sourcefn 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_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.
Sourcefn 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,
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.