pub struct FileModelCatalog { /* private fields */ }Expand description
File-based catalog backed by models.dev SNAP + runtime cache + user
overrides. This is the reference impl of ModelCatalog used by
oxicode-cli and similar products.
Implementations§
Source§impl FileModelCatalog
impl FileModelCatalog
Sourcepub async fn init(config: CatalogConfig) -> Result<Arc<Self>>
pub async fn init(config: CatalogConfig) -> Result<Arc<Self>>
Build the catalog by loading SNAP + cache + overrides. If the cache
is stale and fetch_enabled, attempt one refresh (failure is
silent — SNAP serves as fallback).
Trait Implementations§
Source§impl Debug for FileModelCatalog
impl Debug for FileModelCatalog
Source§impl ModelCatalog for FileModelCatalog
impl ModelCatalog for FileModelCatalog
Source§fn list_providers(
&self,
) -> Pin<Box<dyn Future<Output = SdkResult<Vec<String>>> + Send + '_>>
fn list_providers( &self, ) -> Pin<Box<dyn Future<Output = SdkResult<Vec<String>>> + Send + '_>>
List all known provider IDs (sorted, no duplicates).
Source§fn get_provider(
&self,
provider_id: &str,
) -> Pin<Box<dyn Future<Output = SdkResult<Option<CatalogProviderEntry>>> + Send + '_>>
fn get_provider( &self, provider_id: &str, ) -> Pin<Box<dyn Future<Output = SdkResult<Option<CatalogProviderEntry>>> + Send + '_>>
Look up a single provider by ID.
Source§fn list_models(
&self,
provider_id: &str,
) -> Pin<Box<dyn Future<Output = SdkResult<Vec<CatalogModelEntry>>> + Send + '_>>
fn list_models( &self, provider_id: &str, ) -> Pin<Box<dyn Future<Output = SdkResult<Vec<CatalogModelEntry>>> + Send + '_>>
List all models for a provider (order unspecified).
Source§fn get_model(
&self,
provider_id: &str,
model_id: &str,
) -> Pin<Box<dyn Future<Output = SdkResult<Option<CatalogModelEntry>>> + Send + '_>>
fn get_model( &self, provider_id: &str, model_id: &str, ) -> Pin<Box<dyn Future<Output = SdkResult<Option<CatalogModelEntry>>> + Send + '_>>
Look up a single model by
(provider, model_id).Source§fn search(
&self,
pattern: &str,
) -> Pin<Box<dyn Future<Output = SdkResult<Vec<CatalogModelEntry>>> + Send + '_>>
fn search( &self, pattern: &str, ) -> Pin<Box<dyn Future<Output = SdkResult<Vec<CatalogModelEntry>>> + Send + '_>>
Search models by case-insensitive substring of
provider, model_id,
or name. Empty pattern returns all.Source§fn model_count(
&self,
) -> Pin<Box<dyn Future<Output = SdkResult<usize>> + Send + '_>>
fn model_count( &self, ) -> Pin<Box<dyn Future<Output = SdkResult<usize>> + Send + '_>>
Total number of models across all providers.
Source§fn refresh(
&self,
) -> Pin<Box<dyn Future<Output = SdkResult<RefreshOutcome>> + Send + '_>>
fn refresh( &self, ) -> Pin<Box<dyn Future<Output = SdkResult<RefreshOutcome>> + Send + '_>>
Force a refresh. The implementation decides what “refresh” means
(HTTP fetch, file re-read, etc.).
Source§fn subscribe(&self) -> Receiver<CatalogEvent>
fn subscribe(&self) -> Receiver<CatalogEvent>
Subscribe to catalog lifecycle events. Multiple consumers supported.
Source§fn list_providers_sync(&self) -> Vec<String>
fn list_providers_sync(&self) -> Vec<String>
Sync equivalent of
list_providers.Source§fn get_provider_sync(&self, provider_id: &str) -> Option<CatalogProviderEntry>
fn get_provider_sync(&self, provider_id: &str) -> Option<CatalogProviderEntry>
Sync equivalent of
get_provider.Source§fn list_models_sync(&self, provider_id: &str) -> Vec<CatalogModelEntry>
fn list_models_sync(&self, provider_id: &str) -> Vec<CatalogModelEntry>
Sync equivalent of
list_models.Source§fn get_model_sync(
&self,
provider_id: &str,
model_id: &str,
) -> Option<CatalogModelEntry>
fn get_model_sync( &self, provider_id: &str, model_id: &str, ) -> Option<CatalogModelEntry>
Sync equivalent of
get_model.Source§fn search_sync(&self, pattern: &str) -> Vec<CatalogModelEntry>
fn search_sync(&self, pattern: &str) -> Vec<CatalogModelEntry>
Sync equivalent of
search.Source§fn model_count_sync(&self) -> usize
fn model_count_sync(&self) -> usize
Sync equivalent of
model_count.Auto Trait Implementations§
impl !RefUnwindSafe for FileModelCatalog
impl !UnwindSafe for FileModelCatalog
impl Freeze for FileModelCatalog
impl Send for FileModelCatalog
impl Sync for FileModelCatalog
impl Unpin for FileModelCatalog
impl UnsafeUnpin for FileModelCatalog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.