pub struct Config {
pub providers: HashMap<String, ProviderConfig>,
pub default_provider: Option<String>,
pub default_model: Option<String>,
pub aliases: HashMap<String, String>,
pub system_prompt: Option<String>,
pub templates: HashMap<String, String>,
pub max_tokens: Option<u32>,
pub temperature: Option<f32>,
pub stream: Option<bool>,
}Fields§
§providers: HashMap<String, ProviderConfig>§default_provider: Option<String>§default_model: Option<String>§aliases: HashMap<String, String>§system_prompt: Option<String>§templates: HashMap<String, String>§max_tokens: Option<u32>§temperature: Option<f32>§stream: Option<bool>Implementations§
Source§impl Config
impl Config
pub fn load() -> Result<Self>
pub fn save(&self) -> Result<()>
pub fn add_provider(&mut self, name: String, endpoint: String) -> Result<()>
pub fn add_provider_with_paths( &mut self, name: String, endpoint: String, models_path: Option<String>, chat_path: Option<String>, ) -> Result<()>
pub fn set_api_key(&mut self, provider: String, api_key: String) -> Result<()>
Sourcepub fn has_providers_with_keys(&self) -> bool
pub fn has_providers_with_keys(&self) -> bool
Check if any providers have embedded API keys (for migration detection)
Sourcepub fn get_provider_with_auth(&self, name: &str) -> Result<ProviderConfig>
pub fn get_provider_with_auth(&self, name: &str) -> Result<ProviderConfig>
Get provider with authentication from centralized keys
pub fn has_provider(&self, name: &str) -> bool
pub fn get_provider(&self, name: &str) -> Result<&ProviderConfig>
pub fn add_header( &mut self, provider: String, header_name: String, header_value: String, ) -> Result<()>
pub fn remove_header( &mut self, provider: String, header_name: String, ) -> Result<()>
pub fn list_headers(&self, provider: &str) -> Result<&HashMap<String, String>>
pub fn add_alias( &mut self, alias_name: String, provider_model: String, ) -> Result<()>
pub fn remove_alias(&mut self, alias_name: String) -> Result<()>
pub fn get_alias(&self, alias_name: &str) -> Option<&String>
pub fn list_aliases(&self) -> &HashMap<String, String>
pub fn add_template( &mut self, template_name: String, prompt_content: String, ) -> Result<()>
pub fn remove_template(&mut self, template_name: String) -> Result<()>
pub fn get_template(&self, template_name: &str) -> Option<&String>
pub fn list_templates(&self) -> &HashMap<String, String>
pub fn resolve_template_or_prompt(&self, input: &str) -> String
pub fn parse_max_tokens(input: &str) -> Result<u32>
pub fn parse_temperature(input: &str) -> Result<f32>
pub fn config_dir() -> Result<PathBuf>
pub fn set_token_url( &mut self, provider: String, token_url: String, ) -> Result<()>
pub fn set_provider_var( &mut self, provider: &str, key: &str, value: &str, ) -> Result<()>
pub fn get_provider_var(&self, provider: &str, key: &str) -> Option<&String>
pub fn list_provider_vars( &self, provider: &str, ) -> Result<&HashMap<String, String>>
pub fn set_provider_models_path( &mut self, provider: &str, path: &str, ) -> Result<()>
pub fn set_provider_chat_path( &mut self, provider: &str, path: &str, ) -> Result<()>
pub fn set_provider_images_path( &mut self, provider: &str, path: &str, ) -> Result<()>
pub fn set_provider_embeddings_path( &mut self, provider: &str, path: &str, ) -> Result<()>
pub fn reset_provider_models_path(&mut self, provider: &str) -> Result<()>
pub fn reset_provider_chat_path(&mut self, provider: &str) -> Result<()>
pub fn reset_provider_images_path(&mut self, provider: &str) -> Result<()>
pub fn reset_provider_embeddings_path(&mut self, provider: &str) -> Result<()>
pub fn list_provider_paths(&self, provider: &str) -> Result<ProviderPaths>
pub fn get_token_url(&self, provider: &str) -> Option<&String>
pub fn set_cached_token( &mut self, provider: String, token: String, expires_at: DateTime<Utc>, ) -> Result<()>
pub fn get_cached_token(&self, provider: &str) -> Option<&CachedToken>
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 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
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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.