pub struct CompletionRequest<'a> {
pub model: &'a str,
pub messages: &'a Vec<ChatMessage>,
pub stream: bool,
pub temperature: f32,
pub top_p: f32,
pub max_tokens: Option<u32>,
pub frequency_penalty: f32,
pub presence_penalty: f32,
pub reply_count: u32,
pub functions: &'a Vec<Value>,
}
Expand description
A request struct sent to the API to request a message completion
Fields§
§model: &'a str
The model to be used, currently gpt-3.5-turbo
, but may change in future
messages: &'a Vec<ChatMessage>
The message history, including the message that requires completion, which should be the last one
stream: bool
Whether the message response should be gradually streamed
temperature: f32
The extra randomness of response
top_p: f32
Controls diversity via nucleus sampling, not recommended to use with temperature
max_tokens: Option<u32>
Controls the maximum number of tokens to generate in the completion
frequency_penalty: f32
Determines how much to penalize new tokens based on their existing frequency so far
presence_penalty: f32
Determines how much to penalize new tokens pased on their existing presence so far
reply_count: u32
Determines the amount of output responses
functions: &'a Vec<Value>
All functions that can be called by ChatGPT
Trait Implementations§
Source§impl<'a> Clone for CompletionRequest<'a>
impl<'a> Clone for CompletionRequest<'a>
Source§fn clone(&self) -> CompletionRequest<'a>
fn clone(&self) -> CompletionRequest<'a>
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 moreSource§impl<'a> Debug for CompletionRequest<'a>
impl<'a> Debug for CompletionRequest<'a>
Source§impl<'a> PartialEq for CompletionRequest<'a>
impl<'a> PartialEq for CompletionRequest<'a>
Source§impl<'a> Serialize for CompletionRequest<'a>
impl<'a> Serialize for CompletionRequest<'a>
impl<'a> StructuralPartialEq for CompletionRequest<'a>
Auto Trait Implementations§
impl<'a> Freeze for CompletionRequest<'a>
impl<'a> RefUnwindSafe for CompletionRequest<'a>
impl<'a> Send for CompletionRequest<'a>
impl<'a> Sync for CompletionRequest<'a>
impl<'a> Unpin for CompletionRequest<'a>
impl<'a> UnwindSafe for CompletionRequest<'a>
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