Skip to main content

ModelCatalogPort

Trait ModelCatalogPort 

Source
pub trait ModelCatalogPort:
    Send
    + Sync
    + Debug {
    // Required methods
    fn list_models<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ModelSummary>, CatalogError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn resolve_model<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ModelSummary>, CatalogError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn resolve_for_launch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ModelLaunchSpec>, CatalogError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn record_template_caps<'life0, 'async_trait>(
        &'life0 self,
        _id: u32,
        _caps: TemplateCaps,
    ) -> Pin<Box<dyn Future<Output = Result<(), CatalogError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Port for querying the model catalog.

This interface provides read-only access to the model catalog for listing and resolving models. It does not handle model registration or deletion.

Required Methods§

Source

fn list_models<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ModelSummary>, CatalogError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all models in the catalog.

Returns a list of model summaries ordered by name.

§Errors

Returns CatalogError if the catalog cannot be queried.

Source

fn resolve_model<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ModelSummary>, CatalogError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve a model by name or alias.

This method performs model resolution:

  1. Exact name match
  2. Case-insensitive name match
  3. Fuzzy/partial match (implementation-defined)

Returns None if no matching model is found.

§Arguments
  • name - Model name or alias to resolve
§Errors

Returns CatalogError if the catalog cannot be queried.

Source

fn resolve_for_launch<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ModelLaunchSpec>, CatalogError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve a model for launching.

Returns full launch specification including file path. Use this when you need to actually run a model, not just list it.

§Arguments
  • name - Model name or alias to resolve
§Errors

Returns CatalogError if the catalog cannot be queried.

Provided Methods§

Source

fn record_template_caps<'life0, 'async_trait>( &'life0 self, _id: u32, _caps: TemplateCaps, ) -> Pin<Box<dyn Future<Output = Result<(), CatalogError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Record llama-server’s template-capability self-report for model id.

Called once per fresh launch, after the just-spawned server’s GET /props has been read (ADR 0007: the caps are a fact about the binary–model pair, so only a launch can learn them). Implementations persist only when the stored value differs, so repeat launches of an unchanged pair write nothing.

Defaulted to a no-op because most implementors of this port are read-only views (test doubles, the profiles catalog) with nothing to persist into; only the real database-backed catalog overrides it.

§Errors

Returns CatalogError if the catalog could not be updated.

Implementors§