pub struct Config {
pub default_model: String,
pub logging: bool,
pub aliases: HashMap<String, String>,
pub options: HashMap<String, HashMap<String, Value>>,
pub providers: HashMap<String, Value>,
}Fields§
§default_model: String§logging: bool§aliases: HashMap<String, String>§options: HashMap<String, HashMap<String, Value>>§providers: HashMap<String, Value>Implementations§
Source§impl Config
impl Config
Sourcepub fn load(path: &Path) -> Result<Self>
pub fn load(path: &Path) -> Result<Self>
Load config from a TOML file. Returns defaults if file doesn’t exist.
Sourcepub fn default_model(&self) -> &str
pub fn default_model(&self) -> &str
Returns the effective default model, checking LLM_DEFAULT_MODEL env var first.
Sourcepub fn effective_default_model(&self) -> String
pub fn effective_default_model(&self) -> String
Returns the effective default model (env var LLM_DEFAULT_MODEL takes priority).
Sourcepub fn resolve_model<'a>(&'a self, input: &'a str) -> &'a str
pub fn resolve_model<'a>(&'a self, input: &'a str) -> &'a str
Resolve a model name through aliases. Returns the alias target if found, otherwise returns the input unchanged.
Sourcepub fn save(&self, path: &Path) -> Result<()>
pub fn save(&self, path: &Path) -> Result<()>
Save config to a TOML file, creating parent directories if needed.
Sourcepub fn model_options(&self, model: &str) -> HashMap<String, Value>
pub fn model_options(&self, model: &str) -> HashMap<String, Value>
Returns a clone of all options for a given model (empty if none set).
Sourcepub fn set_option(&mut self, model: &str, key: &str, value: Value)
pub fn set_option(&mut self, model: &str, key: &str, value: Value)
Set a single option for a model.
Sourcepub fn clear_option(&mut self, model: &str, key: &str) -> bool
pub fn clear_option(&mut self, model: &str, key: &str) -> bool
Clear a single option for a model. Returns true if the key existed.
Removes the model entry entirely if no options remain.
Sourcepub fn clear_model_options(&mut self, model: &str) -> bool
pub fn clear_model_options(&mut self, model: &str) -> bool
Clear all options for a model. Returns true if the model had options.
Sourcepub fn remove_alias(&mut self, alias: &str) -> bool
pub fn remove_alias(&mut self, alias: &str) -> bool
Remove an alias. Returns true if the alias existed.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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