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 new() -> ModelSettings
pub fn new() -> ModelSettings
Create new empty settings.
Sourcepub fn max_tokens(self, tokens: u64) -> ModelSettings
pub fn max_tokens(self, tokens: u64) -> ModelSettings
Set max tokens.
Sourcepub fn temperature(self, temp: f64) -> ModelSettings
pub fn temperature(self, temp: f64) -> ModelSettings
Set temperature.
Sourcepub fn top_p(self, p: f64) -> ModelSettings
pub fn top_p(self, p: f64) -> ModelSettings
Set top-p.
Sourcepub fn top_k(self, k: u64) -> ModelSettings
pub fn top_k(self, k: u64) -> ModelSettings
Set top-k.
Sourcepub fn frequency_penalty(self, penalty: f64) -> ModelSettings
pub fn frequency_penalty(self, penalty: f64) -> ModelSettings
Set frequency penalty.
Sourcepub fn presence_penalty(self, penalty: f64) -> ModelSettings
pub fn presence_penalty(self, penalty: f64) -> ModelSettings
Set presence penalty.
Sourcepub fn stop(self, sequences: Vec<String>) -> ModelSettings
pub fn stop(self, sequences: Vec<String>) -> ModelSettings
Set stop sequences.
Sourcepub fn add_stop(self, sequence: impl Into<String>) -> ModelSettings
pub fn add_stop(self, sequence: impl Into<String>) -> ModelSettings
Add a stop sequence.
Sourcepub fn seed(self, seed: u64) -> ModelSettings
pub fn seed(self, seed: u64) -> ModelSettings
Set seed.
Sourcepub fn timeout(self, timeout: Duration) -> ModelSettings
pub fn timeout(self, timeout: Duration) -> ModelSettings
Set timeout.
Sourcepub fn timeout_secs(self, secs: u64) -> ModelSettings
pub fn timeout_secs(self, secs: u64) -> ModelSettings
Set timeout in seconds.
Sourcepub fn parallel_tool_calls(self, parallel: bool) -> ModelSettings
pub fn parallel_tool_calls(self, parallel: bool) -> ModelSettings
Set parallel tool calls.
Sourcepub fn extra(self, extra: Value) -> ModelSettings
pub fn extra(self, extra: Value) -> ModelSettings
Set extra settings.
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<ModelSettings, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ModelSettings, <__D as Deserializer<'de>>::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
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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