pub struct ChatOptions<'a> {
Show 13 fields pub model: ChatModel, pub restart: bool, pub system_prompt: Option<&'a str>, pub pre_prompt: Option<&'a str>, pub post_prompt: Option<&'a str>, pub temperature: Option<f32>, pub top_p: Option<f32>, pub stop: Option<Vec<String>>, pub max_tokens: Option<u16>, pub presence_penalty: Option<f32>, pub frequency_penalty: Option<f32>, pub logit_bias: Option<HashMap<String, i8>>, pub response_format: Option<ResponseFormat>,
}
Expand description

struct for setting the chat options.

Fields§

§model: ChatModel

The ID or name of the model to use for completion.

§restart: bool

When true, a new conversation will be created.

§system_prompt: Option<&'a str>

The prompt of the system role.

§pre_prompt: Option<&'a str>

The prompt that will be prepended to user’s prompt without saving in history.

§post_prompt: Option<&'a str>

The prompt that will be appended to user’s prompt without saving in history.

§temperature: Option<f32>

What sampling temperature to use, between 0 and 2.

§top_p: Option<f32>

An alternative to sampling with temperature

§stop: Option<Vec<String>>

Up to 4 sequences where the API will stop generating further tokens.

§max_tokens: Option<u16>

The maximum number of tokens to generate in the chat completion.

§presence_penalty: Option<f32>

Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model’s likelihood to talk about new topics.

§frequency_penalty: Option<f32>

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model’s likelihood to repeat the same line verbatim.

§logit_bias: Option<HashMap<String, i8>>

Modify the likelihood of specified tokens appearing in the completion.

§response_format: Option<ResponseFormat>

An object specifying the format that the model must output. Used to enable JSON mode.

Trait Implementations§

source§

impl<'a> Debug for ChatOptions<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Default for ChatOptions<'a>

source§

fn default() -> ChatOptions<'a>

Returns the “default value” for a type. Read more
source§

impl<'a> Serialize for ChatOptions<'a>

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for ChatOptions<'a>

§

impl<'a> Send for ChatOptions<'a>

§

impl<'a> Sync for ChatOptions<'a>

§

impl<'a> Unpin for ChatOptions<'a>

§

impl<'a> UnwindSafe for ChatOptions<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.