pub struct Config {
pub api_key: Option<String>,
pub cache_dir: Option<PathBuf>,
pub default_limit: usize,
pub offline_mode: bool,
pub color_output: bool,
pub auto_cache_enabled: bool,
pub cache_ttl_hours: u64,
pub max_cache_size_mb: u64,
pub rag: RagConfig,
pub llm: LlmConfig,
}
Fields§
§api_key: Option<String>
§cache_dir: Option<PathBuf>
§default_limit: usize
§offline_mode: bool
§color_output: bool
§auto_cache_enabled: bool
§cache_ttl_hours: u64
§max_cache_size_mb: u64
§rag: RagConfig
§llm: LlmConfig
Implementations§
Source§impl Config
impl Config
pub fn load() -> Result<Self>
pub fn save(&self) -> Result<()>
pub fn merge_with_cli( &mut self, api_key: Option<String>, cache_dir: Option<PathBuf>, offline: bool, )
pub fn display(&self) -> String
Sourcepub fn should_use_llm(&self, no_llm_flag: bool) -> bool
pub fn should_use_llm(&self, no_llm_flag: bool) -> bool
Check if LLM functionality should be used
Sourcepub fn has_llm_configured(&self) -> bool
pub fn has_llm_configured(&self) -> bool
Check if any LLM provider is configured
Sourcepub fn set_llm_api_key(&mut self, key: String) -> Result<()>
pub fn set_llm_api_key(&mut self, key: String) -> Result<()>
Set LLM API key (auto-detect provider)
Sourcepub fn set_openai_api_key(&mut self, key: String) -> Result<()>
pub fn set_openai_api_key(&mut self, key: String) -> Result<()>
Set OpenAI API key
Sourcepub fn set_anthropic_api_key(&mut self, key: String) -> Result<()>
pub fn set_anthropic_api_key(&mut self, key: String) -> Result<()>
Set Anthropic API key
Sourcepub fn set_groq_api_key(&mut self, key: String) -> Result<()>
pub fn set_groq_api_key(&mut self, key: String) -> Result<()>
Set Groq API key
Sourcepub fn set_openrouter_api_key(&mut self, key: String) -> Result<()>
pub fn set_openrouter_api_key(&mut self, key: String) -> Result<()>
Set OpenRouter API key
Sourcepub fn set_huggingface_api_key(&mut self, key: String) -> Result<()>
pub fn set_huggingface_api_key(&mut self, key: String) -> Result<()>
Set HuggingFace API key
Sourcepub fn set_custom_endpoint(&mut self, endpoint: String) -> Result<()>
pub fn set_custom_endpoint(&mut self, endpoint: String) -> Result<()>
Set custom endpoint
Sourcepub fn set_llm_provider(&mut self, provider: String) -> Result<()>
pub fn set_llm_provider(&mut self, provider: String) -> Result<()>
Set LLM provider preference
Sourcepub fn set_llm_model(&mut self, model: String) -> Result<()>
pub fn set_llm_model(&mut self, model: String) -> Result<()>
Set specific LLM model
Sourcepub fn set_rag_enabled(&mut self, enabled: bool) -> Result<()>
pub fn set_rag_enabled(&mut self, enabled: bool) -> Result<()>
Enable/disable local RAG
Sourcepub fn set_embedding_provider(&mut self, provider_str: &str) -> Result<()>
pub fn set_embedding_provider(&mut self, provider_str: &str) -> Result<()>
Set embedding provider (dimension will be detected dynamically)
Sourcepub fn set_embedding_api_key(&mut self, key: String) -> Result<()>
pub fn set_embedding_api_key(&mut self, key: String) -> Result<()>
Set embedding API key (for API providers)
Sourcepub fn set_embedding_model_path(&mut self, path: PathBuf) -> Result<()>
pub fn set_embedding_model_path(&mut self, path: PathBuf) -> Result<()>
Set embedding model path (for local models)
Sourcepub fn set_embedding_dimension(&mut self, dimension: usize) -> Result<()>
pub fn set_embedding_dimension(&mut self, dimension: usize) -> Result<()>
Set embedding dimension
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 more