pub struct LlmConfig {
pub api_key: String,
pub base_url: String,
pub model: String,
pub infer_retries: usize,
pub temperature: Option<f64>,
pub max_tokens: Option<i64>,
}Expand description
Configuration for the LLM client.
Fields§
§api_key: StringAPI key for authentication.
base_url: StringBase URL for the API.
model: StringModel to use.
infer_retries: usizeMax retries for structured inference.
temperature: Option<f64>Temperature for sampling (0.0 - 2.0). None uses API default.
max_tokens: Option<i64>Maximum tokens to generate. None uses API default.
Implementations§
Source§impl LlmConfig
impl LlmConfig
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create a config from environment variables (native) or WASM config injection (browser).
Sourcepub fn with_model(model: impl Into<String>) -> Self
pub fn with_model(model: impl Into<String>) -> Self
Create a config with specific model and defaults for other settings.
This is useful when you want to override only specific fields like model from an effect handler, while keeping API key and base URL from environment.
Sourcepub fn with_temperature(self, temp: f64) -> Self
pub fn with_temperature(self, temp: f64) -> Self
Set the temperature for this config.
Sourcepub fn with_max_tokens(self, tokens: i64) -> Self
pub fn with_max_tokens(self, tokens: i64) -> Self
Set the max tokens for this config.
Trait Implementations§
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