use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum ResponseFormat {
/// The type of response format being defined: `text`
Text,
/// The type of response format being defined: `json_object`
JsonObject,
/// The type of response format being defined: `json_schema`
JsonSchema {
json_schema: ResponseFormatJsonSchema,
},
}
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
pub struct ResponseFormatJsonSchema {
/// A description of what the response format is for, used by the model to determine how to
/// respond in the format.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes,
/// with a maximum length of 64.
pub name: String,
/// The schema for the response format, described as a JSON Schema object.
/// Learn how to build JSON schemas [here](https://json-schema.org/).
#[serde(skip_serializing_if = "Option::is_none")]
pub schema: Option<serde_json::Value>,
/// Whether to enable strict schema adherence when generating the output.
/// If set to true, the model will always follow the exact schema defined
/// in the `schema` field. Only a subset of JSON Schema is supported when
/// `strict` is `true`. To learn more, read the [Structured Outputs
/// guide](https://platform.openai.com/docs/guides/structured-outputs).
#[serde(skip_serializing_if = "Option::is_none")]
pub strict: Option<bool>,
}