pub struct ModelRegistrar {
model_repo: Arc<dyn ModelRepository>,
gguf_parser: Arc<dyn GgufParserPort>,
model_files_repo: Option<Arc<dyn ModelFilesRepositoryPort>>,
hf_client: Option<Arc<dyn HfClientPort>>,
}Expand description
Implementation of the model registrar port.
This service composes over ModelRepository for persistence and
GgufParserPort for metadata extraction.
Fields§
§model_repo: Arc<dyn ModelRepository>Repository for persisting models.
gguf_parser: Arc<dyn GgufParserPort>Parser for extracting GGUF metadata.
model_files_repo: Option<Arc<dyn ModelFilesRepositoryPort>>Repository for persisting model file metadata.
hf_client: Option<Arc<dyn HfClientPort>>Used to look up the model author’s published sampling recipe.
Optional, and absent means “do not look” rather than “cannot register”.
A registrar without one behaves exactly as it did before this existed:
the reasoning tag guess applies. That keeps the feature off in tests
and in any embedding that has no HF client, without either having to
know it exists.
Implementations§
Source§impl ModelRegistrar
impl ModelRegistrar
Sourcepub fn new(
model_repo: Arc<dyn ModelRepository>,
gguf_parser: Arc<dyn GgufParserPort>,
model_files_repo: Option<Arc<dyn ModelFilesRepositoryPort>>,
) -> Self
pub fn new( model_repo: Arc<dyn ModelRepository>, gguf_parser: Arc<dyn GgufParserPort>, model_files_repo: Option<Arc<dyn ModelFilesRepositoryPort>>, ) -> Self
Create a new model registrar.
§Arguments
model_repo- Repository for persisting modelsgguf_parser- Parser for extracting GGUF metadatamodel_files_repo- Optional repository for persisting model file metadata
Sourcepub fn with_hf_client(self, client: Arc<dyn HfClientPort>) -> Self
pub fn with_hf_client(self, client: Arc<dyn HfClientPort>) -> Self
Look up published sampling recipes at import, using client.
A builder method rather than a fourth constructor parameter: every existing call site wants the previous behaviour, and only the application wiring has an HF client to give.