pub struct LlmConfig {
pub model: String,
pub endpoint: String,
pub api_key: Option<String>,
pub max_tokens: usize,
pub temperature: f32,
pub retry: RetryConfig,
}Expand description
LLM client configuration.
Fields§
§model: StringModel name (e.g., “gpt-4o-mini”, “gpt-4o”).
endpoint: StringAPI endpoint URL.
api_key: Option<String>API key (optional, will use environment variable if not set).
max_tokens: usizeMaximum tokens for response.
temperature: f32Temperature for generation.
retry: RetryConfigRetry configuration.
Implementations§
Source§impl LlmConfig
impl LlmConfig
Sourcepub fn with_model(self, model: impl Into<String>) -> Self
pub fn with_model(self, model: impl Into<String>) -> Self
Set the model.
Sourcepub fn with_endpoint(self, endpoint: impl Into<String>) -> Self
pub fn with_endpoint(self, endpoint: impl Into<String>) -> Self
Set the endpoint.
Sourcepub fn with_api_key(self, api_key: impl Into<String>) -> Self
pub fn with_api_key(self, api_key: impl Into<String>) -> Self
Set the API key.
Sourcepub fn with_max_tokens(self, max_tokens: usize) -> Self
pub fn with_max_tokens(self, max_tokens: usize) -> Self
Set the max tokens.
Sourcepub fn with_temperature(self, temperature: f32) -> Self
pub fn with_temperature(self, temperature: f32) -> Self
Set the temperature.
Sourcepub fn with_retry(self, retry: RetryConfig) -> Self
pub fn with_retry(self, retry: RetryConfig) -> Self
Set the retry configuration.
Sourcepub fn get_api_key(&self) -> Option<String>
pub fn get_api_key(&self) -> Option<String>
Get the API key from config or environment.
Sourcepub fn auto_detect_endpoint(&self) -> String
pub fn auto_detect_endpoint(&self) -> String
Auto-detect the best endpoint based on available API keys.
Sourcepub fn auto_detect_model(&self) -> String
pub fn auto_detect_model(&self) -> String
Auto-detect the best model based on available API keys.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for LlmConfig
impl<'de> Deserialize<'de> for LlmConfig
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
Source§impl From<RetrievalConfig> for LlmConfig
impl From<RetrievalConfig> for LlmConfig
Source§fn from(old: RetrievalConfig) -> Self
fn from(old: RetrievalConfig) -> Self
Converts to this type from the input type.
Source§impl From<SummaryConfig> for LlmConfig
impl From<SummaryConfig> for LlmConfig
Source§fn from(old: SummaryConfig) -> Self
fn from(old: SummaryConfig) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for LlmConfig
impl RefUnwindSafe for LlmConfig
impl Send for LlmConfig
impl Sync for LlmConfig
impl Unpin for LlmConfig
impl UnsafeUnpin for LlmConfig
impl UnwindSafe for LlmConfig
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