pub struct TextGenerationParams {
pub prompt: String,
pub system: Option<String>,
pub model: Option<String>,
pub temperature: Option<f32>,
pub max_tokens: Option<u32>,
pub frequency_penalty: Option<f32>,
pub presence_penalty: Option<f32>,
pub stop: Option<Vec<String>>,
}Expand description
Parameters for text generation.
Fields§
§prompt: StringThe prompt to generate text for.
system: Option<String>Optional system message.
model: Option<String>Optional model override.
temperature: Option<f32>Sampling temperature.
max_tokens: Option<u32>Maximum tokens to generate.
frequency_penalty: Option<f32>Frequency penalty.
presence_penalty: Option<f32>Presence penalty.
stop: Option<Vec<String>>Stop sequences.
Implementations§
Source§impl TextGenerationParams
impl TextGenerationParams
Sourcepub fn temperature(self, temp: f32) -> Self
pub fn temperature(self, temp: f32) -> Self
Set the temperature.
Sourcepub fn max_tokens(self, tokens: u32) -> Self
pub fn max_tokens(self, tokens: u32) -> Self
Set the maximum tokens.
Sourcepub fn frequency_penalty(self, penalty: f32) -> Self
pub fn frequency_penalty(self, penalty: f32) -> Self
Set the frequency penalty.
Sourcepub fn presence_penalty(self, penalty: f32) -> Self
pub fn presence_penalty(self, penalty: f32) -> Self
Set the presence penalty.
Trait Implementations§
Source§impl Clone for TextGenerationParams
impl Clone for TextGenerationParams
Source§fn clone(&self) -> TextGenerationParams
fn clone(&self) -> TextGenerationParams
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 moreAuto Trait Implementations§
impl Freeze for TextGenerationParams
impl RefUnwindSafe for TextGenerationParams
impl Send for TextGenerationParams
impl Sync for TextGenerationParams
impl Unpin for TextGenerationParams
impl UnsafeUnpin for TextGenerationParams
impl UnwindSafe for TextGenerationParams
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more