pub struct GenerationParameters { /* private fields */ }Expand description
Parameters to use when generating text.
Implementations§
Source§impl GenerationParameters
impl GenerationParameters
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a new GenerationParameters
Sourcepub fn with_top_p(self, top_p: f64) -> Self
pub fn with_top_p(self, top_p: f64) -> Self
Set the top_p parameter to the generation parameters (only used by the OpenAI API).
Sourcepub fn with_top_k(self, top_k: u32) -> Self
pub fn with_top_k(self, top_k: u32) -> Self
Set the top_k parameter to the generation parameters (only used by the Anthropic API).
Sourcepub fn with_temperature(self, temperature: f32) -> Self
pub fn with_temperature(self, temperature: f32) -> Self
Set the temperature to use when generating text.
Sourcepub fn with_repetition_penalty(self, repetition_penalty: f32) -> Self
pub fn with_repetition_penalty(self, repetition_penalty: f32) -> Self
Set the repetition penalty to use when generating text.
Sourcepub fn with_repetition_penalty_range(
self,
repetition_penalty_range: u32,
) -> Self
pub fn with_repetition_penalty_range( self, repetition_penalty_range: u32, ) -> Self
Set the repetition penalty range to use when generating text.
Sourcepub fn with_max_length(self, max_length: u32) -> Self
pub fn with_max_length(self, max_length: u32) -> Self
Set the maximum length to use when generating text.
Sourcepub fn with_stop_on(self, stop_on: impl Into<Option<String>>) -> Self
pub fn with_stop_on(self, stop_on: impl Into<Option<String>>) -> Self
Set the string to stop on when generating text.
Sourcepub fn with_seed(self, seed: impl Into<Option<u64>>) -> Self
pub fn with_seed(self, seed: impl Into<Option<u64>>) -> Self
Set the seed to use when generating text.
Sourcepub fn temperature(&self) -> f32
pub fn temperature(&self) -> f32
Get the temperature to use when generating text.
Sourcepub fn repetition_penalty(&self) -> f32
pub fn repetition_penalty(&self) -> f32
Get the repetition penalty to use when generating text.
Sourcepub fn repetition_penalty_range(&self) -> u32
pub fn repetition_penalty_range(&self) -> u32
Get the repetition penalty range to use when generating text.
Sourcepub fn max_length(&self) -> u32
pub fn max_length(&self) -> u32
Get the maximum length to use when generating text.