pub struct ModelCatalog { /* private fields */ }Expand description
Model catalog for looking up models
Implementations§
Source§impl ModelCatalog
impl ModelCatalog
Sourcepub async fn fetch_from(url: &str) -> Result<Self>
pub async fn fetch_from(url: &str) -> Result<Self>
Fetch models with a custom URL (for testing or alternate sources)
Sourcepub fn provider_has_api_key(&self, provider_id: &str) -> bool
pub fn provider_has_api_key(&self, provider_id: &str) -> bool
Check if a provider has an API key configured in HashiCorp Vault
NOTE: This is a sync wrapper that checks the Vault cache.
For initial population, use check_provider_api_key_async.
Sourcepub async fn check_provider_api_key_async(&self, provider_id: &str) -> bool
pub async fn check_provider_api_key_async(&self, provider_id: &str) -> bool
Async check if a provider has an API key in Vault
Sourcepub async fn preload_available_providers(&self) -> Vec<String>
pub async fn preload_available_providers(&self) -> Vec<String>
Pre-load API key availability from Vault for all providers
Sourcepub fn available_providers(&self) -> Vec<&str>
pub fn available_providers(&self) -> Vec<&str>
Get list of providers that have API keys configured (sync, uses cache)
Sourcepub async fn available_providers_async(&self) -> Vec<String>
pub async fn available_providers_async(&self) -> Vec<String>
Get list of providers that have API keys configured (async, checks Vault)
Sourcepub fn get_provider(&self, provider_id: &str) -> Option<&ProviderInfo>
pub fn get_provider(&self, provider_id: &str) -> Option<&ProviderInfo>
Get a provider by ID
Sourcepub fn get_available_provider(&self, provider_id: &str) -> Option<&ProviderInfo>
pub fn get_available_provider(&self, provider_id: &str) -> Option<&ProviderInfo>
Get a provider by ID only if it has an API key
Sourcepub fn get_model(
&self,
provider_id: &str,
model_id: &str,
) -> Option<&ApiModelInfo>
pub fn get_model( &self, provider_id: &str, model_id: &str, ) -> Option<&ApiModelInfo>
Get a model by provider and model ID
Sourcepub fn get_available_model(
&self,
provider_id: &str,
model_id: &str,
) -> Option<&ApiModelInfo>
pub fn get_available_model( &self, provider_id: &str, model_id: &str, ) -> Option<&ApiModelInfo>
Get a model only if the provider has an API key
Sourcepub fn find_model(&self, model_id: &str) -> Option<(&str, &ApiModelInfo)>
pub fn find_model(&self, model_id: &str) -> Option<(&str, &ApiModelInfo)>
Find a model by ID across all providers (only available ones)
Sourcepub fn find_model_any(&self, model_id: &str) -> Option<(&str, &ApiModelInfo)>
pub fn find_model_any(&self, model_id: &str) -> Option<(&str, &ApiModelInfo)>
Find a model across ALL providers (ignoring API key requirement)
Sourcepub fn provider_ids(&self) -> Vec<&str>
pub fn provider_ids(&self) -> Vec<&str>
List all provider IDs (all, not filtered)
Sourcepub fn models_for_provider(&self, provider_id: &str) -> Vec<&ApiModelInfo>
pub fn models_for_provider(&self, provider_id: &str) -> Vec<&ApiModelInfo>
List models for a provider (only if API key available)
Sourcepub fn tool_capable_models(&self) -> Vec<(&str, &ApiModelInfo)>
pub fn tool_capable_models(&self) -> Vec<(&str, &ApiModelInfo)>
Find models with tool calling support (only from available providers)
Sourcepub fn reasoning_models(&self) -> Vec<(&str, &ApiModelInfo)>
pub fn reasoning_models(&self) -> Vec<(&str, &ApiModelInfo)>
Find models with reasoning support (only from available providers)
Sourcepub fn recommended_coding_models(&self) -> Vec<(&str, &ApiModelInfo)>
pub fn recommended_coding_models(&self) -> Vec<(&str, &ApiModelInfo)>
Get recommended models for coding tasks
Sourcepub fn to_model_info(
&self,
model: &ApiModelInfo,
provider_id: &str,
) -> ModelInfo
pub fn to_model_info( &self, model: &ApiModelInfo, provider_id: &str, ) -> ModelInfo
Convert API model info to our internal ModelInfo format
Trait Implementations§
Source§impl Clone for ModelCatalog
impl Clone for ModelCatalog
Source§fn clone(&self) -> ModelCatalog
fn clone(&self) -> ModelCatalog
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelCatalog
impl Debug for ModelCatalog
Source§impl Default for ModelCatalog
impl Default for ModelCatalog
Source§fn default() -> ModelCatalog
fn default() -> ModelCatalog
Auto Trait Implementations§
impl Freeze for ModelCatalog
impl RefUnwindSafe for ModelCatalog
impl Send for ModelCatalog
impl Sync for ModelCatalog
impl Unpin for ModelCatalog
impl UnwindSafe for ModelCatalog
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more