pub struct ModelsConfig {
pub defaults: DefaultsConfig,
pub providers: Vec<ProviderConfig>,
}Expand description
Root configuration structure for models.toml.
Fields§
§defaults: DefaultsConfigDefault selections.
providers: Vec<ProviderConfig>List of configured providers.
Implementations§
Source§impl ModelsConfig
impl ModelsConfig
Sourcepub fn load() -> Result<Self, ModelConfigError>
pub fn load() -> Result<Self, ModelConfigError>
Load configuration from the default location.
Searches in order:
EDGEQUAKE_MODELS_CONFIGenvironment variable./models.toml~/.edgequake/models.toml- Built-in defaults
Sourcepub fn from_file(path: impl AsRef<Path>) -> Result<Self, ModelConfigError>
pub fn from_file(path: impl AsRef<Path>) -> Result<Self, ModelConfigError>
Load configuration from a specific file path.
Sourcepub fn from_toml(toml_str: &str) -> Result<Self, ModelConfigError>
pub fn from_toml(toml_str: &str) -> Result<Self, ModelConfigError>
Parse configuration from TOML string.
Sourcepub fn to_toml(&self) -> Result<String, ModelConfigError>
pub fn to_toml(&self) -> Result<String, ModelConfigError>
Serialize configuration to TOML string.
Sourcepub fn save(&self, path: impl AsRef<Path>) -> Result<(), ModelConfigError>
pub fn save(&self, path: impl AsRef<Path>) -> Result<(), ModelConfigError>
Save configuration to a file.
Sourcepub fn builtin_defaults() -> Self
pub fn builtin_defaults() -> Self
Get built-in default configuration with common providers.
Sourcepub fn get_provider(&self, name: &str) -> Option<&ProviderConfig>
pub fn get_provider(&self, name: &str) -> Option<&ProviderConfig>
Get a provider by name.
Sourcepub fn get_model(&self, provider: &str, model: &str) -> Option<&ModelCard>
pub fn get_model(&self, provider: &str, model: &str) -> Option<&ModelCard>
Get a model by provider and model name.
Sourcepub fn find_provider_for_model(
&self,
model_name: &str,
) -> Option<&ProviderConfig>
pub fn find_provider_for_model( &self, model_name: &str, ) -> Option<&ProviderConfig>
OODA-200: Find a provider by model name.
Searches all enabled providers for a model with the given name. Returns the provider config if found, None otherwise.
§Arguments
model_name- The model identifier to search for (e.g., “glm-4.7”)
§Returns
The provider configuration containing this model, or None.
Sourcepub fn find_provider_and_model(
&self,
model_name: &str,
) -> Option<(&ProviderConfig, &ModelCard)>
pub fn find_provider_and_model( &self, model_name: &str, ) -> Option<(&ProviderConfig, &ModelCard)>
OODA-200: Find a provider and model by model name.
Searches all enabled providers for a model with the given name. Returns both the provider config and model card if found.
§Arguments
model_name- The model identifier to search for (e.g., “glm-4.7”)
§Returns
A tuple of (ProviderConfig, ModelCard) if found, None otherwise.
Sourcepub fn all_llm_models(&self) -> Vec<(&ProviderConfig, &ModelCard)>
pub fn all_llm_models(&self) -> Vec<(&ProviderConfig, &ModelCard)>
Get all LLM models across all providers.
Sourcepub fn all_embedding_models(&self) -> Vec<(&ProviderConfig, &ModelCard)>
pub fn all_embedding_models(&self) -> Vec<(&ProviderConfig, &ModelCard)>
Get all embedding models across all providers.
Sourcepub fn default_llm(&self) -> Option<(&ProviderConfig, &ModelCard)>
pub fn default_llm(&self) -> Option<(&ProviderConfig, &ModelCard)>
Get the default LLM provider and model.
Sourcepub fn default_embedding(&self) -> Option<(&ProviderConfig, &ModelCard)>
pub fn default_embedding(&self) -> Option<(&ProviderConfig, &ModelCard)>
Get the default embedding provider and model.
Sourcepub fn validate(&self) -> Result<(), ModelConfigError>
pub fn validate(&self) -> Result<(), ModelConfigError>
Validate the configuration.
Trait Implementations§
Source§impl Clone for ModelsConfig
impl Clone for ModelsConfig
Source§fn clone(&self) -> ModelsConfig
fn clone(&self) -> ModelsConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more