pub struct GenerationSettings {
pub model: String,
pub frequency_penalty: Option<f32>,
pub presence_penalty: f32,
pub temperature: f32,
pub top_p: Option<f32>,
pub n_choices: u8,
pub n_predict: Option<i32>,
pub n_ctx: u64,
pub logit_bias: Option<Vec<Vec<Value>>>,
pub grammar: Option<String>,
pub stop_sequences: Vec<String>,
}
Expand description
The settings used to generate the completion.
Fields§
§model: String
The model used
frequency_penalty: Option<f32>
§presence_penalty: f32
§temperature: f32
§top_p: Option<f32>
§n_choices: u8
The number of choices to generate.
n_predict: Option<i32>
The number of tokens to predict same as max_tokens.
n_ctx: u64
The maxium context size of the model or server setting.
logit_bias: Option<Vec<Vec<Value>>>
§grammar: Option<String>
§stop_sequences: Vec<String>
Implementations§
Source§impl GenerationSettings
impl GenerationSettings
pub fn new_from_openai( req: &CompletionRequest, res: &OpenAICompletionResponse, ) -> Self
pub fn new_from_anthropic( req: &CompletionRequest, res: &AnthropicCompletionResponse, ) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GenerationSettings
impl RefUnwindSafe for GenerationSettings
impl Send for GenerationSettings
impl Sync for GenerationSettings
impl Unpin for GenerationSettings
impl UnwindSafe for GenerationSettings
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string()
Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString
. Read moreSource§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.