pub struct OpenAiCompletionRequest {
pub model: String,
pub messages: Vec<CompletionRequestMessage>,
pub logit_bias: Option<HashMap<String, Value>>,
pub logprobs: Option<bool>,
pub top_logprobs: Option<u8>,
pub max_tokens: Option<u64>,
pub temperature: Option<f32>,
pub frequency_penalty: Option<f32>,
pub presence_penalty: Option<f32>,
pub stop: Option<Stop>,
pub top_p: Option<f32>,
}
Fields§
§model: String
ID of the model to use. See the model endpoint compatibility table for details on which models work with the Chat API.
messages: Vec<CompletionRequestMessage>
A list of messages comprising the conversation so far. Example Python code.
logit_bias: Option<HashMap<String, Value>>
Modify the likelihood of specified tokens appearing in the completion.
Accepts a json object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.
logprobs: Option<bool>
Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content
of message
.
top_logprobs: Option<u8>
An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs
must be set to true
if this parameter is used.
max_tokens: Option<u64>
The maximum number of tokens that can be generated in the chat completion.
The total length of input tokens and generated tokens is limited by the model’s context length. Example Python code for counting tokens.
temperature: Option<f32>
min: 0.0, max: 2.0, default: None
frequency_penalty: Option<f32>
min: -2.0, max: 2.0, default: None
See more information about frequency and presence penalties.
presence_penalty: Option<f32>
min: -2.0, max: 2.0, default: None
See more information about frequency and presence penalties.
stop: Option<Stop>
Up to 4 sequences where the API will stop generating further tokens.
top_p: Option<f32>
min: 0.0, max: 1.0, default: None
Implementations§
Source§impl OpenAiCompletionRequest
impl OpenAiCompletionRequest
pub fn new(req: &CompletionRequest) -> Result<Self, CompletionError>
Trait Implementations§
Source§impl Clone for OpenAiCompletionRequest
impl Clone for OpenAiCompletionRequest
Source§fn clone(&self) -> OpenAiCompletionRequest
fn clone(&self) -> OpenAiCompletionRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for OpenAiCompletionRequest
impl Debug for OpenAiCompletionRequest
Source§impl Default for OpenAiCompletionRequest
impl Default for OpenAiCompletionRequest
Source§fn default() -> OpenAiCompletionRequest
fn default() -> OpenAiCompletionRequest
Source§impl<'de> Deserialize<'de> for OpenAiCompletionRequest
impl<'de> Deserialize<'de> for OpenAiCompletionRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for OpenAiCompletionRequest
impl PartialEq for OpenAiCompletionRequest
Source§impl Serialize for OpenAiCompletionRequest
impl Serialize for OpenAiCompletionRequest
impl StructuralPartialEq for OpenAiCompletionRequest
Auto Trait Implementations§
impl Freeze for OpenAiCompletionRequest
impl RefUnwindSafe for OpenAiCompletionRequest
impl Send for OpenAiCompletionRequest
impl Sync for OpenAiCompletionRequest
impl Unpin for OpenAiCompletionRequest
impl UnwindSafe for OpenAiCompletionRequest
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
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>
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>
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