pub enum AssistantsApiResponseFormatOption {
Auto,
Format(ResponseFormat),
}
Expand description
Specifies the format that the model must output. Compatible with GPT-4o, GPT-4 Turbo, and all GPT-3.5 Turbo models since gpt-3.5-turbo-1106
.
Setting to { "type": "json_schema", "json_schema": {...} }
enables Structured Outputs which guarantees the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.
Setting to { "type": "json_object" }
enables JSON mode, which guarantees the message the model generates is valid JSON.
Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly “stuck” request. Also note that the message content may be partially cut off if finish_reason="length"
, which indicates the generation exceeded max_tokens
or the conversation exceeded the max context length.
Variants§
Auto
Format(ResponseFormat)
Trait Implementations§
Source§impl Clone for AssistantsApiResponseFormatOption
impl Clone for AssistantsApiResponseFormatOption
Source§fn clone(&self) -> AssistantsApiResponseFormatOption
fn clone(&self) -> AssistantsApiResponseFormatOption
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Default for AssistantsApiResponseFormatOption
impl Default for AssistantsApiResponseFormatOption
Source§fn default() -> AssistantsApiResponseFormatOption
fn default() -> AssistantsApiResponseFormatOption
Source§impl<'de> Deserialize<'de> for AssistantsApiResponseFormatOption
impl<'de> Deserialize<'de> for AssistantsApiResponseFormatOption
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 AssistantsApiResponseFormatOption
impl PartialEq for AssistantsApiResponseFormatOption
Source§fn eq(&self, other: &AssistantsApiResponseFormatOption) -> bool
fn eq(&self, other: &AssistantsApiResponseFormatOption) -> bool
self
and other
values to be equal, and is used by ==
.