pub struct LlmConfig {
pub provider: LlmProvider,
pub model: String,
pub api_key: Option<String>,
pub base_url: Option<String>,
pub temperature: f64,
pub max_tokens: u32,
pub timeout_secs: u64,
pub extra: ProviderExtra,
}Expand description
Configuration for LLM providers
Fields§
§provider: LlmProviderProvider identifier
model: StringModel identifier (provider-specific format)
api_key: Option<String>API key (read from env if not provided)
base_url: Option<String>API base URL (optional override)
temperature: f64Temperature for generation (0.0 - 2.0)
max_tokens: u32Maximum tokens to generate
timeout_secs: u64Request timeout in seconds
extra: ProviderExtraProvider-specific extra configuration
Implementations§
Source§impl LlmConfig
impl LlmConfig
Sourcepub fn for_provider(provider: LlmProvider, model: impl Into<String>) -> Self
pub fn for_provider(provider: LlmProvider, model: impl Into<String>) -> Self
Create config for a specific provider with model
Sourcepub fn with_api_key(self, key: impl Into<String>) -> Self
pub fn with_api_key(self, key: impl Into<String>) -> Self
Set API key
Sourcepub fn with_base_url(self, url: impl Into<String>) -> Self
pub fn with_base_url(self, url: impl Into<String>) -> Self
Set base URL override
Sourcepub fn with_temperature(self, temp: f64) -> Self
pub fn with_temperature(self, temp: f64) -> Self
Set temperature
Sourcepub fn with_max_tokens(self, tokens: u32) -> Self
pub fn with_max_tokens(self, tokens: u32) -> Self
Set max tokens
Sourcepub fn with_azure(
self,
resource: impl Into<String>,
deployment: impl Into<String>,
) -> Self
pub fn with_azure( self, resource: impl Into<String>, deployment: impl Into<String>, ) -> Self
Set Azure-specific configuration
Sourcepub fn with_aws_region(self, region: impl Into<String>) -> Self
pub fn with_aws_region(self, region: impl Into<String>) -> Self
Set AWS Bedrock region
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
Auto Trait Implementations§
impl Freeze for LlmConfig
impl RefUnwindSafe for LlmConfig
impl Send for LlmConfig
impl Sync for LlmConfig
impl Unpin 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