pub struct ModelConfig {
pub provider: String,
pub model: String,
pub max_tokens: u32,
pub temperature: f32,
pub api_key: Option<String>,
pub api_base: Option<String>,
}Expand description
Configuration for the LLM model
Controls which provider and model to use, along with generation parameters.
Fields§
§provider: StringProvider name (e.g., “anthropic”, “openai”)
model: StringModel identifier (e.g., “claude-3-opus-20240229”, “gpt-4”)
max_tokens: u32Maximum tokens to generate per response
temperature: f32Temperature for sampling (0.0 = deterministic, 1.0 = creative)
api_key: Option<String>Optional API key (if not set, reads from environment)
api_base: Option<String>Optional API base URL (for custom endpoints)
Implementations§
Source§impl ModelConfig
impl ModelConfig
Sourcepub fn new(provider: impl Into<String>, model: impl Into<String>) -> Self
pub fn new(provider: impl Into<String>, model: impl Into<String>) -> Self
Create a new model config with the given provider and model
Sourcepub fn with_max_tokens(self, max_tokens: u32) -> Self
pub fn with_max_tokens(self, max_tokens: u32) -> Self
Set the maximum tokens
Sourcepub fn with_temperature(self, temperature: f32) -> Self
pub fn with_temperature(self, temperature: f32) -> Self
Set the temperature
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_api_base(self, api_base: impl Into<String>) -> Self
pub fn with_api_base(self, api_base: impl Into<String>) -> Self
Set the API base URL
Trait Implementations§
Source§impl Clone for ModelConfig
impl Clone for ModelConfig
Source§impl Debug for ModelConfig
impl Debug for ModelConfig
Source§impl Default for ModelConfig
impl Default for ModelConfig
Source§impl<'de> Deserialize<'de> for ModelConfig
impl<'de> Deserialize<'de> for ModelConfig
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 ModelConfig
impl RefUnwindSafe for ModelConfig
impl Send for ModelConfig
impl Sync for ModelConfig
impl Unpin for ModelConfig
impl UnsafeUnpin for ModelConfig
impl UnwindSafe for ModelConfig
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