pub struct ModelSettings {
pub max_tokens: Option<u64>,
pub temperature: Option<f64>,
pub top_p: Option<f64>,
pub top_k: Option<u64>,
pub frequency_penalty: Option<f64>,
pub presence_penalty: Option<f64>,
pub stop: Option<Vec<String>>,
pub seed: Option<u64>,
pub timeout: Option<Duration>,
pub parallel_tool_calls: Option<bool>,
pub extra: Option<Value>,
}Expand description
Settings for model generation.
Fields§
§max_tokens: Option<u64>Maximum tokens to generate.
temperature: Option<f64>Sampling temperature (0.0 to 2.0 typically).
top_p: Option<f64>Top-p (nucleus) sampling.
top_k: Option<u64>Top-k sampling.
frequency_penalty: Option<f64>Frequency penalty (-2.0 to 2.0).
presence_penalty: Option<f64>Presence penalty (-2.0 to 2.0).
stop: Option<Vec<String>>Stop sequences.
seed: Option<u64>Random seed for reproducibility.
timeout: Option<Duration>Request timeout.
parallel_tool_calls: Option<bool>Whether to allow parallel tool calls.
extra: Option<Value>Extra provider-specific settings.
Implementations§
Source§impl ModelSettings
impl ModelSettings
Sourcepub fn max_tokens(self, tokens: u64) -> Self
pub fn max_tokens(self, tokens: u64) -> Self
Set max tokens.
Sourcepub fn temperature(self, temp: f64) -> Self
pub fn temperature(self, temp: f64) -> Self
Set temperature.
Sourcepub fn frequency_penalty(self, penalty: f64) -> Self
pub fn frequency_penalty(self, penalty: f64) -> Self
Set frequency penalty.
Sourcepub fn presence_penalty(self, penalty: f64) -> Self
pub fn presence_penalty(self, penalty: f64) -> Self
Set presence penalty.
Sourcepub fn timeout_secs(self, secs: u64) -> Self
pub fn timeout_secs(self, secs: u64) -> Self
Set timeout in seconds.
Sourcepub fn parallel_tool_calls(self, parallel: bool) -> Self
pub fn parallel_tool_calls(self, parallel: bool) -> Self
Set parallel tool calls.
Sourcepub fn merge(&self, other: &ModelSettings) -> ModelSettings
pub fn merge(&self, other: &ModelSettings) -> ModelSettings
Merge with another settings, preferring values from other.
Values in other override values in self when both are present.
Trait Implementations§
Source§impl Clone for ModelSettings
impl Clone for ModelSettings
Source§fn clone(&self) -> ModelSettings
fn clone(&self) -> ModelSettings
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModelSettings
impl Debug for ModelSettings
Source§impl Default for ModelSettings
impl Default for ModelSettings
Source§fn default() -> ModelSettings
fn default() -> ModelSettings
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ModelSettings
impl<'de> Deserialize<'de> for ModelSettings
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 PartialEq for ModelSettings
impl PartialEq for ModelSettings
Source§impl Serialize for ModelSettings
impl Serialize for ModelSettings
impl StructuralPartialEq for ModelSettings
Auto Trait Implementations§
impl Freeze for ModelSettings
impl RefUnwindSafe for ModelSettings
impl Send for ModelSettings
impl Sync for ModelSettings
impl Unpin for ModelSettings
impl UnwindSafe for ModelSettings
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