pub struct GenerationOptionsBuilder { /* private fields */ }Expand description
Builder for configuring GenerationOptions.
Implementations§
Source§impl GenerationOptionsBuilder
impl GenerationOptionsBuilder
Sourcepub fn temperature(self, temp: f64) -> Self
pub fn temperature(self, temp: f64) -> Self
Sets the temperature for generation.
Temperature influences the confidence of the model’s response. Higher values (e.g., 1.5) produce more random outputs. Lower values (e.g., 0.2) produce more deterministic outputs.
Valid range: 0.0 to 2.0. Values outside this range are ignored and the default temperature is used instead.
Sourcepub fn try_temperature(self, temp: f64) -> Result<Self, Error>
pub fn try_temperature(self, temp: f64) -> Result<Self, Error>
Sets the temperature, returning an error if out of range.
This is the fallible version of temperature.
Use this when you want to catch invalid temperature values at build time.
§Errors
Returns an error if temp is not in the range 0.0 to 2.0.
Sourcepub fn max_response_tokens(self, tokens: u32) -> Self
pub fn max_response_tokens(self, tokens: u32) -> Self
Sets the maximum number of tokens in the response.
Only use this when you need to protect against unexpectedly verbose responses. Enforcing a strict token limit can lead to malformed or grammatically incorrect output.
Sourcepub fn seed(self, seed: u64) -> Self
pub fn seed(self, seed: u64) -> Self
Sets the random seed for reproducible generation.
Note: This is currently not supported by Apple’s GenerationOptions API
and will be ignored. Included for potential future use.
Sourcepub fn build(self) -> GenerationOptions
pub fn build(self) -> GenerationOptions
Builds the GenerationOptions.