pub struct GenerationOptions { /* private fields */ }Expand description
Generation knobs. All fields are optional; unset fields keep the model’s defaults.
§Examples
use foundation_models::{GenerationOptions, SamplingMode};
let opts = GenerationOptions::new()
.with_temperature(0.7)
.with_maximum_response_tokens(500)
.with_sampling(SamplingMode::TopP(0.9));Implementations§
Source§impl GenerationOptions
impl GenerationOptions
Sourcepub const fn with_temperature(self, temperature: f64) -> Self
pub const fn with_temperature(self, temperature: f64) -> Self
Sampling temperature; higher values produce more varied output.
FoundationModels accepts values in 0.0..=2.0.
Sourcepub const fn with_maximum_response_tokens(self, tokens: u32) -> Self
pub const fn with_maximum_response_tokens(self, tokens: u32) -> Self
Hard cap on the number of tokens the model may emit.
Sourcepub const fn with_sampling(self, mode: SamplingMode) -> Self
pub const fn with_sampling(self, mode: SamplingMode) -> Self
Override the sampling strategy.
Trait Implementations§
Source§impl Clone for GenerationOptions
impl Clone for GenerationOptions
Source§fn clone(&self) -> GenerationOptions
fn clone(&self) -> GenerationOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 GenerationOptions
impl Debug for GenerationOptions
Source§impl Default for GenerationOptions
impl Default for GenerationOptions
Source§fn default() -> GenerationOptions
fn default() -> GenerationOptions
Returns the “default value” for a type. Read more
impl Copy for GenerationOptions
Auto Trait Implementations§
impl Freeze for GenerationOptions
impl RefUnwindSafe for GenerationOptions
impl Send for GenerationOptions
impl Sync for GenerationOptions
impl Unpin for GenerationOptions
impl UnsafeUnpin for GenerationOptions
impl UnwindSafe for GenerationOptions
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