pub struct ModelRegistry { /* private fields */ }Expand description
Model registry - manages providers and models at runtime
Implementations§
Source§impl ModelRegistry
impl ModelRegistry
Sourcepub fn register_builtin_provider(
&self,
id: String,
name: String,
models: Vec<Model>,
) -> Result<(), RegistryError>
pub fn register_builtin_provider( &self, id: String, name: String, models: Vec<Model>, ) -> Result<(), RegistryError>
Register a built-in provider
Sourcepub fn register_extension_provider(
&self,
provider: Arc<dyn Provider>,
) -> Result<(), RegistryError>
pub fn register_extension_provider( &self, provider: Arc<dyn Provider>, ) -> Result<(), RegistryError>
Register an extension provider
Sourcepub fn unregister_provider(
&self,
provider_id: &str,
) -> Result<(), RegistryError>
pub fn unregister_provider( &self, provider_id: &str, ) -> Result<(), RegistryError>
Unregister a provider
Sourcepub fn get_provider(&self, provider_id: &str) -> Option<ProviderInfo>
pub fn get_provider(&self, provider_id: &str) -> Option<ProviderInfo>
Get provider info
Sourcepub fn list_providers(&self) -> Vec<ProviderInfo>
pub fn list_providers(&self) -> Vec<ProviderInfo>
Get all providers
Sourcepub fn list_models(&self) -> Vec<Model>
pub fn list_models(&self) -> Vec<Model>
Get all models across all providers
Sourcepub fn list_provider_models(&self, provider_id: &str) -> Vec<Model>
pub fn list_provider_models(&self, provider_id: &str) -> Vec<Model>
Get models for a specific provider
Sourcepub fn update_auth_status(
&self,
provider_id: &str,
status: AuthStatus,
) -> Result<(), RegistryError>
pub fn update_auth_status( &self, provider_id: &str, status: AuthStatus, ) -> Result<(), RegistryError>
Update provider authentication status
Sourcepub fn get_auth_status(&self, provider_id: &str) -> Option<AuthStatus>
pub fn get_auth_status(&self, provider_id: &str) -> Option<AuthStatus>
Get provider authentication status
Sourcepub async fn refresh_catalog(&self) -> Result<(), RegistryError>
pub async fn refresh_catalog(&self) -> Result<(), RegistryError>
Refresh model catalog from models.json
Sourcepub fn last_refresh_time(&self) -> Option<Instant>
pub fn last_refresh_time(&self) -> Option<Instant>
Get last catalog refresh time
Sourcepub fn subscribe(&self) -> Receiver<ModelRegistryEvent>
pub fn subscribe(&self) -> Receiver<ModelRegistryEvent>
Subscribe to registry events
Sourcepub fn get_provider_instance(
&self,
provider_id: &str,
) -> Option<Arc<dyn Provider>>
pub fn get_provider_instance( &self, provider_id: &str, ) -> Option<Arc<dyn Provider>>
Get provider instance for API calls
Sourcepub fn has_provider(&self, provider_id: &str) -> bool
pub fn has_provider(&self, provider_id: &str) -> bool
Check if a provider is registered
Sourcepub fn provider_count(&self) -> usize
pub fn provider_count(&self) -> usize
Get provider count
Sourcepub fn model_count(&self) -> usize
pub fn model_count(&self) -> usize
Get model count
Trait Implementations§
Auto Trait Implementations§
impl Forget for ModelRegistry
impl Freeze for ModelRegistrywhere
*const ArcInner<RwLock<HashMap<String, ProviderInfo>>> is !null: Freeze,
PhantomData<ArcInner<RwLock<HashMap<String, ProviderInfo>>>>: Freeze,
*const ArcInner<RwLock<HashMap<String, Arc<dyn Provider>>>> is !null: Freeze,
PhantomData<ArcInner<RwLock<HashMap<String, Arc<dyn Provider>>>>>: Freeze,
*const ArcInner<Shared<ModelRegistryEvent>> is !null: Freeze,
PhantomData<ArcInner<Shared<ModelRegistryEvent>>>: Freeze,
*const ArcInner<RwLock<Option<Instant>>> is !null: Freeze,
PhantomData<ArcInner<RwLock<Option<Instant>>>>: Freeze,
impl Move for ModelRegistry
impl RefUnwindSafe for ModelRegistrywhere
Atomic<usize>: RefUnwindSafe,
RwLock<HashMap<String, ProviderInfo>>: RefUnwindSafe,
RwLock<HashMap<String, Arc<dyn Provider>>>: RefUnwindSafe,
Mutex<Slot<ModelRegistryEvent>>: RefUnwindSafe,
Mutex<Tail>: RefUnwindSafe,
AtomicUsize: RefUnwindSafe,
Notify: RefUnwindSafe,
RwLock<Option<Instant>>: RefUnwindSafe,
impl Send for ModelRegistry
impl Sync for ModelRegistry
impl Unpin for ModelRegistry
impl UnsafeUnpin for ModelRegistrywhere
*const ArcInner<RwLock<HashMap<String, ProviderInfo>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<HashMap<String, ProviderInfo>>>>: UnsafeUnpin,
*const ArcInner<RwLock<HashMap<String, Arc<dyn Provider>>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<HashMap<String, Arc<dyn Provider>>>>>: UnsafeUnpin,
*const ArcInner<Shared<ModelRegistryEvent>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Shared<ModelRegistryEvent>>>: UnsafeUnpin,
*const ArcInner<RwLock<Option<Instant>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<Option<Instant>>>>: UnsafeUnpin,
impl UnwindSafe for ModelRegistrywhere
Arc<RwLock<HashMap<String, ProviderInfo>>>: UnwindSafe,
Arc<RwLock<HashMap<String, Arc<dyn Provider>>>>: UnwindSafe,
Arc<Shared<ModelRegistryEvent>>: UnwindSafe,
Arc<RwLock<Option<Instant>>>: UnwindSafe,
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> MaybeSendSync for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().