#![allow(
clippy::manual_async_fn,
clippy::needless_return,
clippy::single_match,
clippy::match_single_binding,
clippy::too_many_arguments,
clippy::large_enum_variant,
clippy::enum_variant_names,
dead_code,
unused_imports,
rustdoc::bare_urls,
rustdoc::broken_intra_doc_links
)]
pub mod spec {}
pub mod components {
#![allow(deprecated)]
#![allow(unreachable_patterns)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(clippy::all, clippy::pedantic)]
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionStreamResponseDeltaContent {
ChatCompletionStreamResponseDeltaContentVariant0(String),
ChatCompletionStreamResponseDeltaContentVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<String> for ChatCompletionStreamResponseDeltaContent {
fn from(value: String) -> Self {
ChatCompletionStreamResponseDeltaContent::ChatCompletionStreamResponseDeltaContentVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionStreamResponseDeltaContent> for String {
type Error = ChatCompletionStreamResponseDeltaContent;
fn try_from(
value: ChatCompletionStreamResponseDeltaContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionStreamResponseDeltaContent::ChatCompletionStreamResponseDeltaContentVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for ChatCompletionStreamResponseDeltaContent
{
fn from(value: Option<::serde_json::Value>) -> Self {
ChatCompletionStreamResponseDeltaContent::ChatCompletionStreamResponseDeltaContentVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionStreamResponseDeltaContent>
for Option<::serde_json::Value>
{
type Error = ChatCompletionStreamResponseDeltaContent;
fn try_from(
value: ChatCompletionStreamResponseDeltaContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionStreamResponseDeltaContent::ChatCompletionStreamResponseDeltaContentVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[deprecated]
pub struct ChatCompletionStreamResponseDeltaFunctionCall {
#[serde(skip_serializing_if = "Option::is_none")]
pub arguments: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionMessageToolCallChunkType {
#[serde(rename = "function")]
Function,
}
impl ::std::fmt::Display for ChatCompletionMessageToolCallChunkType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Function => ::std::write!(__f, "function"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionMessageToolCallChunkFunction {
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub arguments: Option<String>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionMessageToolCallChunk {
pub index: i64,
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub r#type: Option<ChatCompletionMessageToolCallChunkType>,
#[serde(skip_serializing_if = "Option::is_none")]
pub function: Option<ChatCompletionMessageToolCallChunkFunction>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionStreamResponseDeltaRole {
#[serde(rename = "developer")]
Developer,
#[serde(rename = "system")]
System,
#[serde(rename = "user")]
User,
#[serde(rename = "assistant")]
Assistant,
#[serde(rename = "tool")]
Tool,
}
impl ::std::fmt::Display for ChatCompletionStreamResponseDeltaRole {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Developer => ::std::write!(__f, "developer"),
Self::System => ::std::write!(__f, "system"),
Self::User => ::std::write!(__f, "user"),
Self::Assistant => ::std::write!(__f, "assistant"),
Self::Tool => ::std::write!(__f, "tool"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionStreamResponseDeltaRefusal {
ChatCompletionStreamResponseDeltaRefusalVariant0(String),
ChatCompletionStreamResponseDeltaRefusalVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<String> for ChatCompletionStreamResponseDeltaRefusal {
fn from(value: String) -> Self {
ChatCompletionStreamResponseDeltaRefusal::ChatCompletionStreamResponseDeltaRefusalVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionStreamResponseDeltaRefusal> for String {
type Error = ChatCompletionStreamResponseDeltaRefusal;
fn try_from(
value: ChatCompletionStreamResponseDeltaRefusal,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionStreamResponseDeltaRefusal::ChatCompletionStreamResponseDeltaRefusalVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for ChatCompletionStreamResponseDeltaRefusal
{
fn from(value: Option<::serde_json::Value>) -> Self {
ChatCompletionStreamResponseDeltaRefusal::ChatCompletionStreamResponseDeltaRefusalVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionStreamResponseDeltaRefusal>
for Option<::serde_json::Value>
{
type Error = ChatCompletionStreamResponseDeltaRefusal;
fn try_from(
value: ChatCompletionStreamResponseDeltaRefusal,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionStreamResponseDeltaRefusal::ChatCompletionStreamResponseDeltaRefusalVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionStreamResponseDelta {
#[serde(skip_serializing_if = "Option::is_none")]
pub content: Option<ChatCompletionStreamResponseDeltaContent>,
#[serde(skip_serializing_if = "Option::is_none")]
#[deprecated]
pub function_call: Option<ChatCompletionStreamResponseDeltaFunctionCall>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tool_calls: Option<Vec<ChatCompletionMessageToolCallChunk>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub role: Option<ChatCompletionStreamResponseDeltaRole>,
#[serde(skip_serializing_if = "Option::is_none")]
pub refusal: Option<ChatCompletionStreamResponseDeltaRefusal>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionTokenLogprobBytes {
ChatCompletionTokenLogprobBytesVariant0(Vec<i64>),
ChatCompletionTokenLogprobBytesVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<Vec<i64>> for ChatCompletionTokenLogprobBytes {
fn from(value: Vec<i64>) -> Self {
ChatCompletionTokenLogprobBytes::ChatCompletionTokenLogprobBytesVariant0(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionTokenLogprobBytes> for Vec<i64> {
type Error = ChatCompletionTokenLogprobBytes;
fn try_from(
value: ChatCompletionTokenLogprobBytes,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionTokenLogprobBytes::ChatCompletionTokenLogprobBytesVariant0(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionTokenLogprobBytes {
fn from(value: Option<::serde_json::Value>) -> Self {
ChatCompletionTokenLogprobBytes::ChatCompletionTokenLogprobBytesVariant1(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionTokenLogprobBytes> for Option<::serde_json::Value> {
type Error = ChatCompletionTokenLogprobBytes;
fn try_from(
value: ChatCompletionTokenLogprobBytes,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionTokenLogprobBytes::ChatCompletionTokenLogprobBytesVariant1(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionTokenLogprobTopLogprobsBytes {
ChatCompletionTokenLogprobTopLogprobsBytesVariant0(Vec<i64>),
ChatCompletionTokenLogprobTopLogprobsBytesVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<Vec<i64>> for ChatCompletionTokenLogprobTopLogprobsBytes {
fn from(value: Vec<i64>) -> Self {
ChatCompletionTokenLogprobTopLogprobsBytes::ChatCompletionTokenLogprobTopLogprobsBytesVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionTokenLogprobTopLogprobsBytes> for Vec<i64> {
type Error = ChatCompletionTokenLogprobTopLogprobsBytes;
fn try_from(
value: ChatCompletionTokenLogprobTopLogprobsBytes,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionTokenLogprobTopLogprobsBytes::ChatCompletionTokenLogprobTopLogprobsBytesVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for ChatCompletionTokenLogprobTopLogprobsBytes
{
fn from(value: Option<::serde_json::Value>) -> Self {
ChatCompletionTokenLogprobTopLogprobsBytes::ChatCompletionTokenLogprobTopLogprobsBytesVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionTokenLogprobTopLogprobsBytes>
for Option<::serde_json::Value>
{
type Error = ChatCompletionTokenLogprobTopLogprobsBytes;
fn try_from(
value: ChatCompletionTokenLogprobTopLogprobsBytes,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionTokenLogprobTopLogprobsBytes::ChatCompletionTokenLogprobTopLogprobsBytesVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionTokenLogprobTopLogprobs {
pub token: String,
pub logprob: f64,
pub bytes: ChatCompletionTokenLogprobTopLogprobsBytes,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionTokenLogprob {
pub token: String,
pub logprob: f64,
pub bytes: ChatCompletionTokenLogprobBytes,
pub top_logprobs: Vec<ChatCompletionTokenLogprobTopLogprobs>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CreateChatCompletionStreamResponseChoicesLogprobs {
pub content: Vec<ChatCompletionTokenLogprob>,
pub refusal: Vec<ChatCompletionTokenLogprob>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum CreateChatCompletionStreamResponseChoicesFinishReason {
#[serde(rename = "stop")]
Stop,
#[serde(rename = "length")]
Length,
#[serde(rename = "tool_calls")]
ToolCalls,
#[serde(rename = "content_filter")]
ContentFilter,
#[serde(rename = "function_call")]
FunctionCall,
}
impl ::std::fmt::Display for CreateChatCompletionStreamResponseChoicesFinishReason {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Stop => ::std::write!(__f, "stop"),
Self::Length => ::std::write!(__f, "length"),
Self::ToolCalls => ::std::write!(__f, "tool_calls"),
Self::ContentFilter => ::std::write!(__f, "content_filter"),
Self::FunctionCall => ::std::write!(__f, "function_call"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CreateChatCompletionStreamResponseChoices {
pub delta: ChatCompletionStreamResponseDelta,
#[serde(skip_serializing_if = "Option::is_none")]
pub logprobs: Option<CreateChatCompletionStreamResponseChoicesLogprobs>,
#[serde(skip_serializing_if = "Option::is_none")]
pub finish_reason: Option<CreateChatCompletionStreamResponseChoicesFinishReason>,
pub index: i64,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ServiceTierVariant0 {
#[serde(rename = "auto")]
Auto,
#[serde(rename = "default")]
Default,
#[serde(rename = "flex")]
Flex,
#[serde(rename = "scale")]
Scale,
#[serde(rename = "priority")]
Priority,
}
impl ::std::fmt::Display for ServiceTierVariant0 {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Auto => ::std::write!(__f, "auto"),
Self::Default => ::std::write!(__f, "default"),
Self::Flex => ::std::write!(__f, "flex"),
Self::Scale => ::std::write!(__f, "scale"),
Self::Priority => ::std::write!(__f, "priority"),
}
}
}
impl ::std::convert::From<ServiceTierVariant0> for ServiceTier {
fn from(value: ServiceTierVariant0) -> Self {
ServiceTier::ServiceTierVariant0(value)
}
}
impl ::std::convert::TryFrom<ServiceTier> for ServiceTierVariant0 {
type Error = ServiceTier;
fn try_from(value: ServiceTier) -> ::std::result::Result<Self, Self::Error> {
match value {
ServiceTier::ServiceTierVariant0(inner) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for ServiceTier {
fn from(value: Option<::serde_json::Value>) -> Self {
ServiceTier::ServiceTierVariant1(value)
}
}
impl ::std::convert::TryFrom<ServiceTier> for Option<::serde_json::Value> {
type Error = ServiceTier;
fn try_from(value: ServiceTier) -> ::std::result::Result<Self, Self::Error> {
match value {
ServiceTier::ServiceTierVariant1(inner) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ServiceTier {
ServiceTierVariant0(ServiceTierVariant0),
ServiceTierVariant1(Option<::serde_json::Value>),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum CreateChatCompletionStreamResponseObject {
#[serde(rename = "chat.completion.chunk")]
ChatCompletionChunk,
}
impl ::std::fmt::Display for CreateChatCompletionStreamResponseObject {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::ChatCompletionChunk => ::std::write!(__f, "chat.completion.chunk"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CompletionUsageCompletionTokensDetails {
#[serde(skip_serializing_if = "Option::is_none")]
pub accepted_prediction_tokens: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub audio_tokens: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reasoning_tokens: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub rejected_prediction_tokens: Option<i64>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CompletionUsagePromptTokensDetails {
#[serde(skip_serializing_if = "Option::is_none")]
pub audio_tokens: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cached_tokens: Option<i64>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CompletionUsage {
pub completion_tokens: i64,
pub prompt_tokens: i64,
pub total_tokens: i64,
#[serde(skip_serializing_if = "Option::is_none")]
pub completion_tokens_details: Option<CompletionUsageCompletionTokensDetails>,
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_tokens_details: Option<CompletionUsagePromptTokensDetails>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CreateChatCompletionStreamResponse {
pub id: String,
pub choices: Vec<CreateChatCompletionStreamResponseChoices>,
pub created: i64,
pub model: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub service_tier: Option<ServiceTier>,
#[serde(skip_serializing_if = "Option::is_none")]
#[deprecated]
pub system_fingerprint: Option<String>,
pub object: CreateChatCompletionStreamResponseObject,
#[serde(skip_serializing_if = "Option::is_none")]
pub usage: Option<CompletionUsage>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionStreamOptionsVariant0 {
#[serde(skip_serializing_if = "Option::is_none")]
pub include_usage: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub include_obfuscation: Option<bool>,
}
impl ::std::convert::From<ChatCompletionStreamOptionsVariant0> for ChatCompletionStreamOptions {
fn from(value: ChatCompletionStreamOptionsVariant0) -> Self {
ChatCompletionStreamOptions::ChatCompletionStreamOptionsVariant0(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionStreamOptions> for ChatCompletionStreamOptionsVariant0 {
type Error = ChatCompletionStreamOptions;
fn try_from(
value: ChatCompletionStreamOptions,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionStreamOptions::ChatCompletionStreamOptionsVariant0(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionStreamOptions {
fn from(value: Option<::serde_json::Value>) -> Self {
ChatCompletionStreamOptions::ChatCompletionStreamOptionsVariant1(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionStreamOptions> for Option<::serde_json::Value> {
type Error = ChatCompletionStreamOptions;
fn try_from(
value: ChatCompletionStreamOptions,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionStreamOptions::ChatCompletionStreamOptionsVariant1(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionStreamOptions {
ChatCompletionStreamOptionsVariant0(ChatCompletionStreamOptionsVariant0),
ChatCompletionStreamOptionsVariant1(Option<::serde_json::Value>),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionToolType {
#[serde(rename = "function")]
Function,
}
impl ::std::fmt::Display for ChatCompletionToolType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Function => ::std::write!(__f, "function"),
}
}
}
pub type FunctionParameters = ::std::collections::BTreeMap<String, ::serde_json::Value>;
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum FunctionObjectStrict {
FunctionObjectStrictVariant0(bool),
FunctionObjectStrictVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<bool> for FunctionObjectStrict {
fn from(value: bool) -> Self {
FunctionObjectStrict::FunctionObjectStrictVariant0(value)
}
}
impl ::std::convert::TryFrom<FunctionObjectStrict> for bool {
type Error = FunctionObjectStrict;
fn try_from(value: FunctionObjectStrict) -> ::std::result::Result<Self, Self::Error> {
match value {
FunctionObjectStrict::FunctionObjectStrictVariant0(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for FunctionObjectStrict {
fn from(value: Option<::serde_json::Value>) -> Self {
FunctionObjectStrict::FunctionObjectStrictVariant1(value)
}
}
impl ::std::convert::TryFrom<FunctionObjectStrict> for Option<::serde_json::Value> {
type Error = FunctionObjectStrict;
fn try_from(value: FunctionObjectStrict) -> ::std::result::Result<Self, Self::Error> {
match value {
FunctionObjectStrict::FunctionObjectStrictVariant1(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct FunctionObject {
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub parameters: Option<FunctionParameters>,
#[serde(skip_serializing_if = "Option::is_none")]
pub strict: Option<FunctionObjectStrict>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionTool {
pub r#type: ChatCompletionToolType,
pub function: FunctionObject,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionToolChoiceOptionVariant0 {
#[serde(rename = "none")]
None,
#[serde(rename = "auto")]
Auto,
#[serde(rename = "required")]
Required,
}
impl ::std::fmt::Display for ChatCompletionToolChoiceOptionVariant0 {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::None => ::std::write!(__f, "none"),
Self::Auto => ::std::write!(__f, "auto"),
Self::Required => ::std::write!(__f, "required"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionAllowedToolsChoiceType {
#[serde(rename = "allowed_tools")]
AllowedTools,
}
impl ::std::fmt::Display for ChatCompletionAllowedToolsChoiceType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::AllowedTools => ::std::write!(__f, "allowed_tools"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionAllowedToolsMode {
#[serde(rename = "auto")]
Auto,
#[serde(rename = "required")]
Required,
}
impl ::std::fmt::Display for ChatCompletionAllowedToolsMode {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Auto => ::std::write!(__f, "auto"),
Self::Required => ::std::write!(__f, "required"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionAllowedTools {
pub mode: ChatCompletionAllowedToolsMode,
pub tools: Vec<::std::collections::BTreeMap<String, ::serde_json::Value>>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionAllowedToolsChoice {
pub r#type: ChatCompletionAllowedToolsChoiceType,
pub allowed_tools: ChatCompletionAllowedTools,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionNamedToolChoiceType {
#[serde(rename = "function")]
Function,
}
impl ::std::fmt::Display for ChatCompletionNamedToolChoiceType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Function => ::std::write!(__f, "function"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionNamedToolChoiceFunction {
pub name: String,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionNamedToolChoice {
pub r#type: ChatCompletionNamedToolChoiceType,
pub function: ChatCompletionNamedToolChoiceFunction,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionNamedToolChoiceCustomType {
#[serde(rename = "custom")]
Custom,
}
impl ::std::fmt::Display for ChatCompletionNamedToolChoiceCustomType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Custom => ::std::write!(__f, "custom"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionNamedToolChoiceCustomCustom {
pub name: String,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionNamedToolChoiceCustom {
pub r#type: ChatCompletionNamedToolChoiceCustomType,
pub custom: ChatCompletionNamedToolChoiceCustomCustom,
}
impl ::std::convert::From<ChatCompletionToolChoiceOptionVariant0>
for ChatCompletionToolChoiceOption
{
fn from(value: ChatCompletionToolChoiceOptionVariant0) -> Self {
ChatCompletionToolChoiceOption::ChatCompletionToolChoiceOptionVariant0(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionToolChoiceOption>
for ChatCompletionToolChoiceOptionVariant0
{
type Error = ChatCompletionToolChoiceOption;
fn try_from(
value: ChatCompletionToolChoiceOption,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionToolChoiceOption::ChatCompletionToolChoiceOptionVariant0(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ChatCompletionAllowedToolsChoice> for ChatCompletionToolChoiceOption {
fn from(value: ChatCompletionAllowedToolsChoice) -> Self {
ChatCompletionToolChoiceOption::ChatCompletionAllowedToolsChoice(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionToolChoiceOption> for ChatCompletionAllowedToolsChoice {
type Error = ChatCompletionToolChoiceOption;
fn try_from(
value: ChatCompletionToolChoiceOption,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionToolChoiceOption::ChatCompletionAllowedToolsChoice(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ChatCompletionNamedToolChoice> for ChatCompletionToolChoiceOption {
fn from(value: ChatCompletionNamedToolChoice) -> Self {
ChatCompletionToolChoiceOption::ChatCompletionNamedToolChoice(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionToolChoiceOption> for ChatCompletionNamedToolChoice {
type Error = ChatCompletionToolChoiceOption;
fn try_from(
value: ChatCompletionToolChoiceOption,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionToolChoiceOption::ChatCompletionNamedToolChoice(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ChatCompletionNamedToolChoiceCustom> for ChatCompletionToolChoiceOption {
fn from(value: ChatCompletionNamedToolChoiceCustom) -> Self {
ChatCompletionToolChoiceOption::ChatCompletionNamedToolChoiceCustom(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionToolChoiceOption>
for ChatCompletionNamedToolChoiceCustom
{
type Error = ChatCompletionToolChoiceOption;
fn try_from(
value: ChatCompletionToolChoiceOption,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionToolChoiceOption::ChatCompletionNamedToolChoiceCustom(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionToolChoiceOption {
ChatCompletionToolChoiceOptionVariant0(ChatCompletionToolChoiceOptionVariant0),
ChatCompletionAllowedToolsChoice(ChatCompletionAllowedToolsChoice),
ChatCompletionNamedToolChoice(ChatCompletionNamedToolChoice),
ChatCompletionNamedToolChoiceCustom(ChatCompletionNamedToolChoiceCustom),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum VoiceIdsSharedVariant1 {
#[serde(rename = "alloy")]
Alloy,
#[serde(rename = "ash")]
Ash,
#[serde(rename = "ballad")]
Ballad,
#[serde(rename = "coral")]
Coral,
#[serde(rename = "echo")]
Echo,
#[serde(rename = "sage")]
Sage,
#[serde(rename = "shimmer")]
Shimmer,
#[serde(rename = "verse")]
Verse,
#[serde(rename = "marin")]
Marin,
#[serde(rename = "cedar")]
Cedar,
}
impl ::std::fmt::Display for VoiceIdsSharedVariant1 {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Alloy => ::std::write!(__f, "alloy"),
Self::Ash => ::std::write!(__f, "ash"),
Self::Ballad => ::std::write!(__f, "ballad"),
Self::Coral => ::std::write!(__f, "coral"),
Self::Echo => ::std::write!(__f, "echo"),
Self::Sage => ::std::write!(__f, "sage"),
Self::Shimmer => ::std::write!(__f, "shimmer"),
Self::Verse => ::std::write!(__f, "verse"),
Self::Marin => ::std::write!(__f, "marin"),
Self::Cedar => ::std::write!(__f, "cedar"),
}
}
}
impl ::std::convert::From<String> for VoiceIdsShared {
fn from(value: String) -> Self {
VoiceIdsShared::VoiceIdsSharedVariant0(value)
}
}
impl ::std::convert::TryFrom<VoiceIdsShared> for String {
type Error = VoiceIdsShared;
fn try_from(value: VoiceIdsShared) -> ::std::result::Result<Self, Self::Error> {
match value {
VoiceIdsShared::VoiceIdsSharedVariant0(inner) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<VoiceIdsSharedVariant1> for VoiceIdsShared {
fn from(value: VoiceIdsSharedVariant1) -> Self {
VoiceIdsShared::VoiceIdsSharedVariant1(value)
}
}
impl ::std::convert::TryFrom<VoiceIdsShared> for VoiceIdsSharedVariant1 {
type Error = VoiceIdsShared;
fn try_from(value: VoiceIdsShared) -> ::std::result::Result<Self, Self::Error> {
match value {
VoiceIdsShared::VoiceIdsSharedVariant1(inner) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum VoiceIdsShared {
VoiceIdsSharedVariant0(String),
VoiceIdsSharedVariant1(VoiceIdsSharedVariant1),
}
impl ::std::convert::From<::std::collections::BTreeMap<String, String>> for Metadata {
fn from(value: ::std::collections::BTreeMap<String, String>) -> Self {
Metadata::MetadataVariant0(value)
}
}
impl ::std::convert::TryFrom<Metadata> for ::std::collections::BTreeMap<String, String> {
type Error = Metadata;
fn try_from(value: Metadata) -> ::std::result::Result<Self, Self::Error> {
match value {
Metadata::MetadataVariant0(inner) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for Metadata {
fn from(value: Option<::serde_json::Value>) -> Self {
Metadata::MetadataVariant1(value)
}
}
impl ::std::convert::TryFrom<Metadata> for Option<::serde_json::Value> {
type Error = Metadata;
fn try_from(value: Metadata) -> ::std::result::Result<Self, Self::Error> {
match value {
Metadata::MetadataVariant1(inner) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum Metadata {
MetadataVariant0(::std::collections::BTreeMap<String, String>),
MetadataVariant1(Option<::serde_json::Value>),
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CreateModelResponsePropertiesTopLogprobs {
CreateModelResponsePropertiesTopLogprobsVariant0(i64),
CreateModelResponsePropertiesTopLogprobsVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<i64> for CreateModelResponsePropertiesTopLogprobs {
fn from(value: i64) -> Self {
CreateModelResponsePropertiesTopLogprobs::CreateModelResponsePropertiesTopLogprobsVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<CreateModelResponsePropertiesTopLogprobs> for i64 {
type Error = CreateModelResponsePropertiesTopLogprobs;
fn try_from(
value: CreateModelResponsePropertiesTopLogprobs,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateModelResponsePropertiesTopLogprobs::CreateModelResponsePropertiesTopLogprobsVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for CreateModelResponsePropertiesTopLogprobs
{
fn from(value: Option<::serde_json::Value>) -> Self {
CreateModelResponsePropertiesTopLogprobs::CreateModelResponsePropertiesTopLogprobsVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<CreateModelResponsePropertiesTopLogprobs>
for Option<::serde_json::Value>
{
type Error = CreateModelResponsePropertiesTopLogprobs;
fn try_from(
value: CreateModelResponsePropertiesTopLogprobs,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateModelResponsePropertiesTopLogprobs::CreateModelResponsePropertiesTopLogprobsVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CreateModelResponsePropertiesTemperature {
CreateModelResponsePropertiesTemperatureVariant0(f64),
CreateModelResponsePropertiesTemperatureVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<f64> for CreateModelResponsePropertiesTemperature {
fn from(value: f64) -> Self {
CreateModelResponsePropertiesTemperature::CreateModelResponsePropertiesTemperatureVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<CreateModelResponsePropertiesTemperature> for f64 {
type Error = CreateModelResponsePropertiesTemperature;
fn try_from(
value: CreateModelResponsePropertiesTemperature,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateModelResponsePropertiesTemperature::CreateModelResponsePropertiesTemperatureVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for CreateModelResponsePropertiesTemperature
{
fn from(value: Option<::serde_json::Value>) -> Self {
CreateModelResponsePropertiesTemperature::CreateModelResponsePropertiesTemperatureVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<CreateModelResponsePropertiesTemperature>
for Option<::serde_json::Value>
{
type Error = CreateModelResponsePropertiesTemperature;
fn try_from(
value: CreateModelResponsePropertiesTemperature,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateModelResponsePropertiesTemperature::CreateModelResponsePropertiesTemperatureVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CreateModelResponsePropertiesTopP {
CreateModelResponsePropertiesTopPVariant0(f64),
CreateModelResponsePropertiesTopPVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<f64> for CreateModelResponsePropertiesTopP {
fn from(value: f64) -> Self {
CreateModelResponsePropertiesTopP::CreateModelResponsePropertiesTopPVariant0(value)
}
}
impl ::std::convert::TryFrom<CreateModelResponsePropertiesTopP> for f64 {
type Error = CreateModelResponsePropertiesTopP;
fn try_from(
value: CreateModelResponsePropertiesTopP,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateModelResponsePropertiesTopP::CreateModelResponsePropertiesTopPVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for CreateModelResponsePropertiesTopP {
fn from(value: Option<::serde_json::Value>) -> Self {
CreateModelResponsePropertiesTopP::CreateModelResponsePropertiesTopPVariant1(value)
}
}
impl ::std::convert::TryFrom<CreateModelResponsePropertiesTopP> for Option<::serde_json::Value> {
type Error = CreateModelResponsePropertiesTopP;
fn try_from(
value: CreateModelResponsePropertiesTopP,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateModelResponsePropertiesTopP::CreateModelResponsePropertiesTopPVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum CreateModelResponsePropertiesPromptCacheRetentionVariant0 {
#[serde(rename = "in_memory")]
InMemory,
#[serde(rename = "24h")]
_24h,
}
impl ::std::fmt::Display for CreateModelResponsePropertiesPromptCacheRetentionVariant0 {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::InMemory => ::std::write!(__f, "in_memory"),
Self::_24h => ::std::write!(__f, "24h"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CreateModelResponsePropertiesPromptCacheRetention {
CreateModelResponsePropertiesPromptCacheRetentionVariant0(
CreateModelResponsePropertiesPromptCacheRetentionVariant0,
),
CreateModelResponsePropertiesPromptCacheRetentionVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<CreateModelResponsePropertiesPromptCacheRetentionVariant0>
for CreateModelResponsePropertiesPromptCacheRetention
{
fn from(value: CreateModelResponsePropertiesPromptCacheRetentionVariant0) -> Self {
CreateModelResponsePropertiesPromptCacheRetention::CreateModelResponsePropertiesPromptCacheRetentionVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<CreateModelResponsePropertiesPromptCacheRetention>
for CreateModelResponsePropertiesPromptCacheRetentionVariant0
{
type Error = CreateModelResponsePropertiesPromptCacheRetention;
fn try_from(
value: CreateModelResponsePropertiesPromptCacheRetention,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateModelResponsePropertiesPromptCacheRetention::CreateModelResponsePropertiesPromptCacheRetentionVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for CreateModelResponsePropertiesPromptCacheRetention
{
fn from(value: Option<::serde_json::Value>) -> Self {
CreateModelResponsePropertiesPromptCacheRetention::CreateModelResponsePropertiesPromptCacheRetentionVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<CreateModelResponsePropertiesPromptCacheRetention>
for Option<::serde_json::Value>
{
type Error = CreateModelResponsePropertiesPromptCacheRetention;
fn try_from(
value: CreateModelResponsePropertiesPromptCacheRetention,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateModelResponsePropertiesPromptCacheRetention::CreateModelResponsePropertiesPromptCacheRetentionVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CreateModelResponseProperties {
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<Metadata>,
#[serde(skip_serializing_if = "Option::is_none")]
pub top_logprobs: Option<CreateModelResponsePropertiesTopLogprobs>,
#[serde(skip_serializing_if = "Option::is_none")]
pub temperature: Option<CreateModelResponsePropertiesTemperature>,
#[serde(skip_serializing_if = "Option::is_none")]
pub top_p: Option<CreateModelResponsePropertiesTopP>,
#[serde(skip_serializing_if = "Option::is_none")]
#[deprecated]
pub user: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_identifier: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_cache_key: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub service_tier: Option<ServiceTier>,
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_cache_retention: Option<CreateModelResponsePropertiesPromptCacheRetention>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct VoiceIdsOrCustomVoiceVariant1 {
pub id: String,
}
impl ::std::convert::From<VoiceIdsShared> for VoiceIdsOrCustomVoice {
fn from(value: VoiceIdsShared) -> Self {
VoiceIdsOrCustomVoice::VoiceIdsShared(value)
}
}
impl ::std::convert::TryFrom<VoiceIdsOrCustomVoice> for VoiceIdsShared {
type Error = VoiceIdsOrCustomVoice;
fn try_from(value: VoiceIdsOrCustomVoice) -> ::std::result::Result<Self, Self::Error> {
match value {
VoiceIdsOrCustomVoice::VoiceIdsShared(inner) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<VoiceIdsOrCustomVoiceVariant1> for VoiceIdsOrCustomVoice {
fn from(value: VoiceIdsOrCustomVoiceVariant1) -> Self {
VoiceIdsOrCustomVoice::VoiceIdsOrCustomVoiceVariant1(value)
}
}
impl ::std::convert::TryFrom<VoiceIdsOrCustomVoice> for VoiceIdsOrCustomVoiceVariant1 {
type Error = VoiceIdsOrCustomVoice;
fn try_from(value: VoiceIdsOrCustomVoice) -> ::std::result::Result<Self, Self::Error> {
match value {
VoiceIdsOrCustomVoice::VoiceIdsOrCustomVoiceVariant1(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum VoiceIdsOrCustomVoice {
VoiceIdsShared(VoiceIdsShared),
VoiceIdsOrCustomVoiceVariant1(VoiceIdsOrCustomVoiceVariant1),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum CustomToolChatCompletionsType {
#[serde(rename = "custom")]
Custom,
}
impl ::std::fmt::Display for CustomToolChatCompletionsType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Custom => ::std::write!(__f, "custom"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum CustomToolChatCompletionsCustomFormatVariant0Type {
#[serde(rename = "text")]
Text,
}
impl ::std::fmt::Display for CustomToolChatCompletionsCustomFormatVariant0Type {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Text => ::std::write!(__f, "text"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CustomToolChatCompletionsCustomFormatVariant0 {
pub r#type: CustomToolChatCompletionsCustomFormatVariant0Type,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum CustomToolChatCompletionsCustomFormatVariant1Type {
#[serde(rename = "grammar")]
Grammar,
}
impl ::std::fmt::Display for CustomToolChatCompletionsCustomFormatVariant1Type {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Grammar => ::std::write!(__f, "grammar"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum CustomToolChatCompletionsCustomFormatVariant1GrammarSyntax {
#[serde(rename = "lark")]
Lark,
#[serde(rename = "regex")]
Regex,
}
impl ::std::fmt::Display for CustomToolChatCompletionsCustomFormatVariant1GrammarSyntax {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Lark => ::std::write!(__f, "lark"),
Self::Regex => ::std::write!(__f, "regex"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CustomToolChatCompletionsCustomFormatVariant1Grammar {
pub definition: String,
pub syntax: CustomToolChatCompletionsCustomFormatVariant1GrammarSyntax,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CustomToolChatCompletionsCustomFormatVariant1 {
pub r#type: CustomToolChatCompletionsCustomFormatVariant1Type,
pub grammar: CustomToolChatCompletionsCustomFormatVariant1Grammar,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CustomToolChatCompletionsCustomFormat {
CustomToolChatCompletionsCustomFormatVariant0(
CustomToolChatCompletionsCustomFormatVariant0,
),
CustomToolChatCompletionsCustomFormatVariant1(
CustomToolChatCompletionsCustomFormatVariant1,
),
}
impl ::std::convert::From<CustomToolChatCompletionsCustomFormatVariant0>
for CustomToolChatCompletionsCustomFormat
{
fn from(value: CustomToolChatCompletionsCustomFormatVariant0) -> Self {
CustomToolChatCompletionsCustomFormat::CustomToolChatCompletionsCustomFormatVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<CustomToolChatCompletionsCustomFormat>
for CustomToolChatCompletionsCustomFormatVariant0
{
type Error = CustomToolChatCompletionsCustomFormat;
fn try_from(
value: CustomToolChatCompletionsCustomFormat,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CustomToolChatCompletionsCustomFormat::CustomToolChatCompletionsCustomFormatVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<CustomToolChatCompletionsCustomFormatVariant1>
for CustomToolChatCompletionsCustomFormat
{
fn from(value: CustomToolChatCompletionsCustomFormatVariant1) -> Self {
CustomToolChatCompletionsCustomFormat::CustomToolChatCompletionsCustomFormatVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<CustomToolChatCompletionsCustomFormat>
for CustomToolChatCompletionsCustomFormatVariant1
{
type Error = CustomToolChatCompletionsCustomFormat;
fn try_from(
value: CustomToolChatCompletionsCustomFormat,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CustomToolChatCompletionsCustomFormat::CustomToolChatCompletionsCustomFormatVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CustomToolChatCompletionsCustom {
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<CustomToolChatCompletionsCustomFormat>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CustomToolChatCompletions {
pub r#type: CustomToolChatCompletionsType,
pub custom: CustomToolChatCompletionsCustom,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ModelIdsSharedVariant1 {
#[serde(rename = "gpt-5.4")]
Gpt54,
#[serde(rename = "gpt-5.4-mini")]
Gpt54Mini,
#[serde(rename = "gpt-5.4-nano")]
Gpt54Nano,
#[serde(rename = "gpt-5.4-mini-2026-03-17")]
Gpt54Mini2026Minus03Minus17,
#[serde(rename = "gpt-5.4-nano-2026-03-17")]
Gpt54Nano2026Minus03Minus17,
#[serde(rename = "gpt-5.3-chat-latest")]
Gpt53ChatLatest,
#[serde(rename = "gpt-5.2")]
Gpt52,
#[serde(rename = "gpt-5.2-2025-12-11")]
Gpt52Minus2025Minus12Minus11,
#[serde(rename = "gpt-5.2-chat-latest")]
Gpt52ChatLatest,
#[serde(rename = "gpt-5.2-pro")]
Gpt52Pro,
#[serde(rename = "gpt-5.2-pro-2025-12-11")]
Gpt52Pro2025Minus12Minus11,
#[serde(rename = "gpt-5.1")]
Gpt51,
#[serde(rename = "gpt-5.1-2025-11-13")]
Gpt51Minus2025Minus11Minus13,
#[serde(rename = "gpt-5.1-codex")]
Gpt51Codex,
#[serde(rename = "gpt-5.1-mini")]
Gpt51Mini,
#[serde(rename = "gpt-5.1-chat-latest")]
Gpt51ChatLatest,
#[serde(rename = "gpt-5")]
Gpt5,
#[serde(rename = "gpt-5-mini")]
Gpt5Mini,
#[serde(rename = "gpt-5-nano")]
Gpt5Nano,
#[serde(rename = "gpt-5-2025-08-07")]
Gpt5Minus2025Minus08Minus07,
#[serde(rename = "gpt-5-mini-2025-08-07")]
Gpt5Mini2025Minus08Minus07,
#[serde(rename = "gpt-5-nano-2025-08-07")]
Gpt5Nano2025Minus08Minus07,
#[serde(rename = "gpt-5-chat-latest")]
Gpt5ChatLatest,
#[serde(rename = "gpt-4.1")]
Gpt41,
#[serde(rename = "gpt-4.1-mini")]
Gpt41Mini,
#[serde(rename = "gpt-4.1-nano")]
Gpt41Nano,
#[serde(rename = "gpt-4.1-2025-04-14")]
Gpt41Minus2025Minus04Minus14,
#[serde(rename = "gpt-4.1-mini-2025-04-14")]
Gpt41Mini2025Minus04Minus14,
#[serde(rename = "gpt-4.1-nano-2025-04-14")]
Gpt41Nano2025Minus04Minus14,
#[serde(rename = "o4-mini")]
O4Mini,
#[serde(rename = "o4-mini-2025-04-16")]
O4Mini2025Minus04Minus16,
#[serde(rename = "o3")]
O3,
#[serde(rename = "o3-2025-04-16")]
O3Minus2025Minus04Minus16,
#[serde(rename = "o3-mini")]
O3Mini,
#[serde(rename = "o3-mini-2025-01-31")]
O3Mini2025Minus01Minus31,
#[serde(rename = "o1")]
O1,
#[serde(rename = "o1-2024-12-17")]
O1Minus2024Minus12Minus17,
#[serde(rename = "o1-preview")]
O1Preview,
#[serde(rename = "o1-preview-2024-09-12")]
O1Preview2024Minus09Minus12,
#[serde(rename = "o1-mini")]
O1Mini,
#[serde(rename = "o1-mini-2024-09-12")]
O1Mini2024Minus09Minus12,
#[serde(rename = "gpt-4o")]
Gpt4o,
#[serde(rename = "gpt-4o-2024-11-20")]
Gpt4o2024Minus11Minus20,
#[serde(rename = "gpt-4o-2024-08-06")]
Gpt4o2024Minus08Minus06,
#[serde(rename = "gpt-4o-2024-05-13")]
Gpt4o2024Minus05Minus13,
#[serde(rename = "gpt-4o-audio-preview")]
Gpt4oAudioPreview,
#[serde(rename = "gpt-4o-audio-preview-2024-10-01")]
Gpt4oAudioPreview2024Minus10Minus01,
#[serde(rename = "gpt-4o-audio-preview-2024-12-17")]
Gpt4oAudioPreview2024Minus12Minus17,
#[serde(rename = "gpt-4o-audio-preview-2025-06-03")]
Gpt4oAudioPreview2025Minus06Minus03,
#[serde(rename = "gpt-4o-mini-audio-preview")]
Gpt4oMiniAudioPreview,
#[serde(rename = "gpt-4o-mini-audio-preview-2024-12-17")]
Gpt4oMiniAudioPreview2024Minus12Minus17,
#[serde(rename = "gpt-4o-search-preview")]
Gpt4oSearchPreview,
#[serde(rename = "gpt-4o-mini-search-preview")]
Gpt4oMiniSearchPreview,
#[serde(rename = "gpt-4o-search-preview-2025-03-11")]
Gpt4oSearchPreview2025Minus03Minus11,
#[serde(rename = "gpt-4o-mini-search-preview-2025-03-11")]
Gpt4oMiniSearchPreview2025Minus03Minus11,
#[serde(rename = "chatgpt-4o-latest")]
Chatgpt4oLatest,
#[serde(rename = "codex-mini-latest")]
CodexMiniLatest,
#[serde(rename = "gpt-4o-mini")]
Gpt4oMini,
#[serde(rename = "gpt-4o-mini-2024-07-18")]
Gpt4oMini2024Minus07Minus18,
#[serde(rename = "gpt-4-turbo")]
Gpt4Turbo,
#[serde(rename = "gpt-4-turbo-2024-04-09")]
Gpt4Turbo2024Minus04Minus09,
#[serde(rename = "gpt-4-0125-preview")]
Gpt4Minus0125Preview,
#[serde(rename = "gpt-4-turbo-preview")]
Gpt4TurboPreview,
#[serde(rename = "gpt-4-1106-preview")]
Gpt4Minus1106Preview,
#[serde(rename = "gpt-4-vision-preview")]
Gpt4VisionPreview,
#[serde(rename = "gpt-4")]
Gpt4,
#[serde(rename = "gpt-4-0314")]
Gpt4Minus0314,
#[serde(rename = "gpt-4-0613")]
Gpt4Minus0613,
#[serde(rename = "gpt-4-32k")]
Gpt4Minus32k,
#[serde(rename = "gpt-4-32k-0314")]
Gpt4Minus32k0314,
#[serde(rename = "gpt-4-32k-0613")]
Gpt4Minus32k0613,
#[serde(rename = "gpt-3.5-turbo")]
Gpt35Turbo,
#[serde(rename = "gpt-3.5-turbo-16k")]
Gpt35Turbo16k,
#[serde(rename = "gpt-3.5-turbo-0301")]
Gpt35Turbo0301,
#[serde(rename = "gpt-3.5-turbo-0613")]
Gpt35Turbo0613,
#[serde(rename = "gpt-3.5-turbo-1106")]
Gpt35Turbo1106,
#[serde(rename = "gpt-3.5-turbo-0125")]
Gpt35Turbo0125,
#[serde(rename = "gpt-3.5-turbo-16k-0613")]
Gpt35Turbo16k0613,
}
impl ::std::fmt::Display for ModelIdsSharedVariant1 {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Gpt54 => ::std::write!(__f, "gpt-5.4"),
Self::Gpt54Mini => ::std::write!(__f, "gpt-5.4-mini"),
Self::Gpt54Nano => ::std::write!(__f, "gpt-5.4-nano"),
Self::Gpt54Mini2026Minus03Minus17 => {
::std::write!(__f, "gpt-5.4-mini-2026-03-17")
}
Self::Gpt54Nano2026Minus03Minus17 => {
::std::write!(__f, "gpt-5.4-nano-2026-03-17")
}
Self::Gpt53ChatLatest => ::std::write!(__f, "gpt-5.3-chat-latest"),
Self::Gpt52 => ::std::write!(__f, "gpt-5.2"),
Self::Gpt52Minus2025Minus12Minus11 => {
::std::write!(__f, "gpt-5.2-2025-12-11")
}
Self::Gpt52ChatLatest => ::std::write!(__f, "gpt-5.2-chat-latest"),
Self::Gpt52Pro => ::std::write!(__f, "gpt-5.2-pro"),
Self::Gpt52Pro2025Minus12Minus11 => {
::std::write!(__f, "gpt-5.2-pro-2025-12-11")
}
Self::Gpt51 => ::std::write!(__f, "gpt-5.1"),
Self::Gpt51Minus2025Minus11Minus13 => {
::std::write!(__f, "gpt-5.1-2025-11-13")
}
Self::Gpt51Codex => ::std::write!(__f, "gpt-5.1-codex"),
Self::Gpt51Mini => ::std::write!(__f, "gpt-5.1-mini"),
Self::Gpt51ChatLatest => ::std::write!(__f, "gpt-5.1-chat-latest"),
Self::Gpt5 => ::std::write!(__f, "gpt-5"),
Self::Gpt5Mini => ::std::write!(__f, "gpt-5-mini"),
Self::Gpt5Nano => ::std::write!(__f, "gpt-5-nano"),
Self::Gpt5Minus2025Minus08Minus07 => {
::std::write!(__f, "gpt-5-2025-08-07")
}
Self::Gpt5Mini2025Minus08Minus07 => {
::std::write!(__f, "gpt-5-mini-2025-08-07")
}
Self::Gpt5Nano2025Minus08Minus07 => {
::std::write!(__f, "gpt-5-nano-2025-08-07")
}
Self::Gpt5ChatLatest => ::std::write!(__f, "gpt-5-chat-latest"),
Self::Gpt41 => ::std::write!(__f, "gpt-4.1"),
Self::Gpt41Mini => ::std::write!(__f, "gpt-4.1-mini"),
Self::Gpt41Nano => ::std::write!(__f, "gpt-4.1-nano"),
Self::Gpt41Minus2025Minus04Minus14 => {
::std::write!(__f, "gpt-4.1-2025-04-14")
}
Self::Gpt41Mini2025Minus04Minus14 => {
::std::write!(__f, "gpt-4.1-mini-2025-04-14")
}
Self::Gpt41Nano2025Minus04Minus14 => {
::std::write!(__f, "gpt-4.1-nano-2025-04-14")
}
Self::O4Mini => ::std::write!(__f, "o4-mini"),
Self::O4Mini2025Minus04Minus16 => {
::std::write!(__f, "o4-mini-2025-04-16")
}
Self::O3 => ::std::write!(__f, "o3"),
Self::O3Minus2025Minus04Minus16 => ::std::write!(__f, "o3-2025-04-16"),
Self::O3Mini => ::std::write!(__f, "o3-mini"),
Self::O3Mini2025Minus01Minus31 => {
::std::write!(__f, "o3-mini-2025-01-31")
}
Self::O1 => ::std::write!(__f, "o1"),
Self::O1Minus2024Minus12Minus17 => ::std::write!(__f, "o1-2024-12-17"),
Self::O1Preview => ::std::write!(__f, "o1-preview"),
Self::O1Preview2024Minus09Minus12 => {
::std::write!(__f, "o1-preview-2024-09-12")
}
Self::O1Mini => ::std::write!(__f, "o1-mini"),
Self::O1Mini2024Minus09Minus12 => {
::std::write!(__f, "o1-mini-2024-09-12")
}
Self::Gpt4o => ::std::write!(__f, "gpt-4o"),
Self::Gpt4o2024Minus11Minus20 => ::std::write!(__f, "gpt-4o-2024-11-20"),
Self::Gpt4o2024Minus08Minus06 => ::std::write!(__f, "gpt-4o-2024-08-06"),
Self::Gpt4o2024Minus05Minus13 => ::std::write!(__f, "gpt-4o-2024-05-13"),
Self::Gpt4oAudioPreview => ::std::write!(__f, "gpt-4o-audio-preview"),
Self::Gpt4oAudioPreview2024Minus10Minus01 => {
::std::write!(__f, "gpt-4o-audio-preview-2024-10-01")
}
Self::Gpt4oAudioPreview2024Minus12Minus17 => {
::std::write!(__f, "gpt-4o-audio-preview-2024-12-17")
}
Self::Gpt4oAudioPreview2025Minus06Minus03 => {
::std::write!(__f, "gpt-4o-audio-preview-2025-06-03")
}
Self::Gpt4oMiniAudioPreview => {
::std::write!(__f, "gpt-4o-mini-audio-preview")
}
Self::Gpt4oMiniAudioPreview2024Minus12Minus17 => {
::std::write!(__f, "gpt-4o-mini-audio-preview-2024-12-17")
}
Self::Gpt4oSearchPreview => ::std::write!(__f, "gpt-4o-search-preview"),
Self::Gpt4oMiniSearchPreview => {
::std::write!(__f, "gpt-4o-mini-search-preview")
}
Self::Gpt4oSearchPreview2025Minus03Minus11 => {
::std::write!(__f, "gpt-4o-search-preview-2025-03-11")
}
Self::Gpt4oMiniSearchPreview2025Minus03Minus11 => {
::std::write!(__f, "gpt-4o-mini-search-preview-2025-03-11")
}
Self::Chatgpt4oLatest => ::std::write!(__f, "chatgpt-4o-latest"),
Self::CodexMiniLatest => ::std::write!(__f, "codex-mini-latest"),
Self::Gpt4oMini => ::std::write!(__f, "gpt-4o-mini"),
Self::Gpt4oMini2024Minus07Minus18 => {
::std::write!(__f, "gpt-4o-mini-2024-07-18")
}
Self::Gpt4Turbo => ::std::write!(__f, "gpt-4-turbo"),
Self::Gpt4Turbo2024Minus04Minus09 => {
::std::write!(__f, "gpt-4-turbo-2024-04-09")
}
Self::Gpt4Minus0125Preview => ::std::write!(__f, "gpt-4-0125-preview"),
Self::Gpt4TurboPreview => ::std::write!(__f, "gpt-4-turbo-preview"),
Self::Gpt4Minus1106Preview => ::std::write!(__f, "gpt-4-1106-preview"),
Self::Gpt4VisionPreview => ::std::write!(__f, "gpt-4-vision-preview"),
Self::Gpt4 => ::std::write!(__f, "gpt-4"),
Self::Gpt4Minus0314 => ::std::write!(__f, "gpt-4-0314"),
Self::Gpt4Minus0613 => ::std::write!(__f, "gpt-4-0613"),
Self::Gpt4Minus32k => ::std::write!(__f, "gpt-4-32k"),
Self::Gpt4Minus32k0314 => ::std::write!(__f, "gpt-4-32k-0314"),
Self::Gpt4Minus32k0613 => ::std::write!(__f, "gpt-4-32k-0613"),
Self::Gpt35Turbo => ::std::write!(__f, "gpt-3.5-turbo"),
Self::Gpt35Turbo16k => ::std::write!(__f, "gpt-3.5-turbo-16k"),
Self::Gpt35Turbo0301 => ::std::write!(__f, "gpt-3.5-turbo-0301"),
Self::Gpt35Turbo0613 => ::std::write!(__f, "gpt-3.5-turbo-0613"),
Self::Gpt35Turbo1106 => ::std::write!(__f, "gpt-3.5-turbo-1106"),
Self::Gpt35Turbo0125 => ::std::write!(__f, "gpt-3.5-turbo-0125"),
Self::Gpt35Turbo16k0613 => ::std::write!(__f, "gpt-3.5-turbo-16k-0613"),
}
}
}
impl ::std::convert::From<String> for ModelIdsShared {
fn from(value: String) -> Self {
ModelIdsShared::ModelIdsSharedVariant0(value)
}
}
impl ::std::convert::TryFrom<ModelIdsShared> for String {
type Error = ModelIdsShared;
fn try_from(value: ModelIdsShared) -> ::std::result::Result<Self, Self::Error> {
match value {
ModelIdsShared::ModelIdsSharedVariant0(inner) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ModelIdsSharedVariant1> for ModelIdsShared {
fn from(value: ModelIdsSharedVariant1) -> Self {
ModelIdsShared::ModelIdsSharedVariant1(value)
}
}
impl ::std::convert::TryFrom<ModelIdsShared> for ModelIdsSharedVariant1 {
type Error = ModelIdsShared;
fn try_from(value: ModelIdsShared) -> ::std::result::Result<Self, Self::Error> {
match value {
ModelIdsShared::ModelIdsSharedVariant1(inner) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ModelIdsShared {
ModelIdsSharedVariant0(String),
ModelIdsSharedVariant1(ModelIdsSharedVariant1),
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ModelResponsePropertiesTopLogprobs {
ModelResponsePropertiesTopLogprobsVariant0(i64),
ModelResponsePropertiesTopLogprobsVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<i64> for ModelResponsePropertiesTopLogprobs {
fn from(value: i64) -> Self {
ModelResponsePropertiesTopLogprobs::ModelResponsePropertiesTopLogprobsVariant0(value)
}
}
impl ::std::convert::TryFrom<ModelResponsePropertiesTopLogprobs> for i64 {
type Error = ModelResponsePropertiesTopLogprobs;
fn try_from(
value: ModelResponsePropertiesTopLogprobs,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ModelResponsePropertiesTopLogprobs::ModelResponsePropertiesTopLogprobsVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for ModelResponsePropertiesTopLogprobs {
fn from(value: Option<::serde_json::Value>) -> Self {
ModelResponsePropertiesTopLogprobs::ModelResponsePropertiesTopLogprobsVariant1(value)
}
}
impl ::std::convert::TryFrom<ModelResponsePropertiesTopLogprobs> for Option<::serde_json::Value> {
type Error = ModelResponsePropertiesTopLogprobs;
fn try_from(
value: ModelResponsePropertiesTopLogprobs,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ModelResponsePropertiesTopLogprobs::ModelResponsePropertiesTopLogprobsVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ModelResponsePropertiesTemperature {
ModelResponsePropertiesTemperatureVariant0(f64),
ModelResponsePropertiesTemperatureVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<f64> for ModelResponsePropertiesTemperature {
fn from(value: f64) -> Self {
ModelResponsePropertiesTemperature::ModelResponsePropertiesTemperatureVariant0(value)
}
}
impl ::std::convert::TryFrom<ModelResponsePropertiesTemperature> for f64 {
type Error = ModelResponsePropertiesTemperature;
fn try_from(
value: ModelResponsePropertiesTemperature,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ModelResponsePropertiesTemperature::ModelResponsePropertiesTemperatureVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for ModelResponsePropertiesTemperature {
fn from(value: Option<::serde_json::Value>) -> Self {
ModelResponsePropertiesTemperature::ModelResponsePropertiesTemperatureVariant1(value)
}
}
impl ::std::convert::TryFrom<ModelResponsePropertiesTemperature> for Option<::serde_json::Value> {
type Error = ModelResponsePropertiesTemperature;
fn try_from(
value: ModelResponsePropertiesTemperature,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ModelResponsePropertiesTemperature::ModelResponsePropertiesTemperatureVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ModelResponsePropertiesTopP {
ModelResponsePropertiesTopPVariant0(f64),
ModelResponsePropertiesTopPVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<f64> for ModelResponsePropertiesTopP {
fn from(value: f64) -> Self {
ModelResponsePropertiesTopP::ModelResponsePropertiesTopPVariant0(value)
}
}
impl ::std::convert::TryFrom<ModelResponsePropertiesTopP> for f64 {
type Error = ModelResponsePropertiesTopP;
fn try_from(
value: ModelResponsePropertiesTopP,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ModelResponsePropertiesTopP::ModelResponsePropertiesTopPVariant0(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for ModelResponsePropertiesTopP {
fn from(value: Option<::serde_json::Value>) -> Self {
ModelResponsePropertiesTopP::ModelResponsePropertiesTopPVariant1(value)
}
}
impl ::std::convert::TryFrom<ModelResponsePropertiesTopP> for Option<::serde_json::Value> {
type Error = ModelResponsePropertiesTopP;
fn try_from(
value: ModelResponsePropertiesTopP,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ModelResponsePropertiesTopP::ModelResponsePropertiesTopPVariant1(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ModelResponsePropertiesPromptCacheRetentionVariant0 {
#[serde(rename = "in_memory")]
InMemory,
#[serde(rename = "24h")]
_24h,
}
impl ::std::fmt::Display for ModelResponsePropertiesPromptCacheRetentionVariant0 {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::InMemory => ::std::write!(__f, "in_memory"),
Self::_24h => ::std::write!(__f, "24h"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ModelResponsePropertiesPromptCacheRetention {
ModelResponsePropertiesPromptCacheRetentionVariant0(
ModelResponsePropertiesPromptCacheRetentionVariant0,
),
ModelResponsePropertiesPromptCacheRetentionVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<ModelResponsePropertiesPromptCacheRetentionVariant0>
for ModelResponsePropertiesPromptCacheRetention
{
fn from(value: ModelResponsePropertiesPromptCacheRetentionVariant0) -> Self {
ModelResponsePropertiesPromptCacheRetention::ModelResponsePropertiesPromptCacheRetentionVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ModelResponsePropertiesPromptCacheRetention>
for ModelResponsePropertiesPromptCacheRetentionVariant0
{
type Error = ModelResponsePropertiesPromptCacheRetention;
fn try_from(
value: ModelResponsePropertiesPromptCacheRetention,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ModelResponsePropertiesPromptCacheRetention::ModelResponsePropertiesPromptCacheRetentionVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for ModelResponsePropertiesPromptCacheRetention
{
fn from(value: Option<::serde_json::Value>) -> Self {
ModelResponsePropertiesPromptCacheRetention::ModelResponsePropertiesPromptCacheRetentionVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ModelResponsePropertiesPromptCacheRetention>
for Option<::serde_json::Value>
{
type Error = ModelResponsePropertiesPromptCacheRetention;
fn try_from(
value: ModelResponsePropertiesPromptCacheRetention,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ModelResponsePropertiesPromptCacheRetention::ModelResponsePropertiesPromptCacheRetentionVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ModelResponseProperties {
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<Metadata>,
#[serde(skip_serializing_if = "Option::is_none")]
pub top_logprobs: Option<ModelResponsePropertiesTopLogprobs>,
#[serde(skip_serializing_if = "Option::is_none")]
pub temperature: Option<ModelResponsePropertiesTemperature>,
#[serde(skip_serializing_if = "Option::is_none")]
pub top_p: Option<ModelResponsePropertiesTopP>,
#[serde(skip_serializing_if = "Option::is_none")]
#[deprecated]
pub user: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_identifier: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_cache_key: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub service_tier: Option<ServiceTier>,
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_cache_retention: Option<ModelResponsePropertiesPromptCacheRetention>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum VerbosityVariant0 {
#[serde(rename = "low")]
Low,
#[serde(rename = "medium")]
Medium,
#[serde(rename = "high")]
High,
}
impl ::std::fmt::Display for VerbosityVariant0 {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Low => ::std::write!(__f, "low"),
Self::Medium => ::std::write!(__f, "medium"),
Self::High => ::std::write!(__f, "high"),
}
}
}
impl ::std::convert::From<VerbosityVariant0> for Verbosity {
fn from(value: VerbosityVariant0) -> Self {
Verbosity::VerbosityVariant0(value)
}
}
impl ::std::convert::TryFrom<Verbosity> for VerbosityVariant0 {
type Error = Verbosity;
fn try_from(value: Verbosity) -> ::std::result::Result<Self, Self::Error> {
match value {
Verbosity::VerbosityVariant0(inner) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for Verbosity {
fn from(value: Option<::serde_json::Value>) -> Self {
Verbosity::VerbosityVariant1(value)
}
}
impl ::std::convert::TryFrom<Verbosity> for Option<::serde_json::Value> {
type Error = Verbosity;
fn try_from(value: Verbosity) -> ::std::result::Result<Self, Self::Error> {
match value {
Verbosity::VerbosityVariant1(inner) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum Verbosity {
VerbosityVariant0(VerbosityVariant0),
VerbosityVariant1(Option<::serde_json::Value>),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum PredictionContentType {
#[serde(rename = "content")]
Content,
}
impl ::std::fmt::Display for PredictionContentType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Content => ::std::write!(__f, "content"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionRequestMessageContentPartTextType {
#[serde(rename = "text")]
Text,
}
impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartTextType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Text => ::std::write!(__f, "text"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionRequestMessageContentPartText {
pub r#type: ChatCompletionRequestMessageContentPartTextType,
pub text: String,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum PredictionContentContent {
PredictionContentContentVariant0(String),
PredictionContentContentVariant1(Vec<ChatCompletionRequestMessageContentPartText>),
}
impl ::std::convert::From<String> for PredictionContentContent {
fn from(value: String) -> Self {
PredictionContentContent::PredictionContentContentVariant0(value)
}
}
impl ::std::convert::TryFrom<PredictionContentContent> for String {
type Error = PredictionContentContent;
fn try_from(value: PredictionContentContent) -> ::std::result::Result<Self, Self::Error> {
match value {
PredictionContentContent::PredictionContentContentVariant0(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Vec<ChatCompletionRequestMessageContentPartText>>
for PredictionContentContent
{
fn from(value: Vec<ChatCompletionRequestMessageContentPartText>) -> Self {
PredictionContentContent::PredictionContentContentVariant1(value)
}
}
impl ::std::convert::TryFrom<PredictionContentContent>
for Vec<ChatCompletionRequestMessageContentPartText>
{
type Error = PredictionContentContent;
fn try_from(value: PredictionContentContent) -> ::std::result::Result<Self, Self::Error> {
match value {
PredictionContentContent::PredictionContentContentVariant1(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct PredictionContent {
pub r#type: PredictionContentType,
pub content: PredictionContentContent,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ReasoningEffortVariant0 {
#[serde(rename = "none")]
None,
#[serde(rename = "minimal")]
Minimal,
#[serde(rename = "low")]
Low,
#[serde(rename = "medium")]
Medium,
#[serde(rename = "high")]
High,
#[serde(rename = "xhigh")]
Xhigh,
}
impl ::std::fmt::Display for ReasoningEffortVariant0 {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::None => ::std::write!(__f, "none"),
Self::Minimal => ::std::write!(__f, "minimal"),
Self::Low => ::std::write!(__f, "low"),
Self::Medium => ::std::write!(__f, "medium"),
Self::High => ::std::write!(__f, "high"),
Self::Xhigh => ::std::write!(__f, "xhigh"),
}
}
}
impl ::std::convert::From<ReasoningEffortVariant0> for ReasoningEffort {
fn from(value: ReasoningEffortVariant0) -> Self {
ReasoningEffort::ReasoningEffortVariant0(value)
}
}
impl ::std::convert::TryFrom<ReasoningEffort> for ReasoningEffortVariant0 {
type Error = ReasoningEffort;
fn try_from(value: ReasoningEffort) -> ::std::result::Result<Self, Self::Error> {
match value {
ReasoningEffort::ReasoningEffortVariant0(inner) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for ReasoningEffort {
fn from(value: Option<::serde_json::Value>) -> Self {
ReasoningEffort::ReasoningEffortVariant1(value)
}
}
impl ::std::convert::TryFrom<ReasoningEffort> for Option<::serde_json::Value> {
type Error = ReasoningEffort;
fn try_from(value: ReasoningEffort) -> ::std::result::Result<Self, Self::Error> {
match value {
ReasoningEffort::ReasoningEffortVariant1(inner) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ReasoningEffort {
ReasoningEffortVariant0(ReasoningEffortVariant0),
ReasoningEffortVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<String> for StopConfiguration {
fn from(value: String) -> Self {
StopConfiguration::StopConfigurationVariant0(value)
}
}
impl ::std::convert::TryFrom<StopConfiguration> for String {
type Error = StopConfiguration;
fn try_from(value: StopConfiguration) -> ::std::result::Result<Self, Self::Error> {
match value {
StopConfiguration::StopConfigurationVariant0(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Vec<String>> for StopConfiguration {
fn from(value: Vec<String>) -> Self {
StopConfiguration::StopConfigurationVariant1(value)
}
}
impl ::std::convert::TryFrom<StopConfiguration> for Vec<String> {
type Error = StopConfiguration;
fn try_from(value: StopConfiguration) -> ::std::result::Result<Self, Self::Error> {
match value {
StopConfiguration::StopConfigurationVariant1(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum StopConfiguration {
StopConfigurationVariant0(String),
StopConfigurationVariant1(Vec<String>),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ResponseModalitiesVariant0 {
#[serde(rename = "text")]
Text,
#[serde(rename = "audio")]
Audio,
}
impl ::std::fmt::Display for ResponseModalitiesVariant0 {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Text => ::std::write!(__f, "text"),
Self::Audio => ::std::write!(__f, "audio"),
}
}
}
impl ::std::convert::From<Vec<ResponseModalitiesVariant0>> for ResponseModalities {
fn from(value: Vec<ResponseModalitiesVariant0>) -> Self {
ResponseModalities::ResponseModalitiesVariant0(value)
}
}
impl ::std::convert::TryFrom<ResponseModalities> for Vec<ResponseModalitiesVariant0> {
type Error = ResponseModalities;
fn try_from(value: ResponseModalities) -> ::std::result::Result<Self, Self::Error> {
match value {
ResponseModalities::ResponseModalitiesVariant0(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for ResponseModalities {
fn from(value: Option<::serde_json::Value>) -> Self {
ResponseModalities::ResponseModalitiesVariant1(value)
}
}
impl ::std::convert::TryFrom<ResponseModalities> for Option<::serde_json::Value> {
type Error = ResponseModalities;
fn try_from(value: ResponseModalities) -> ::std::result::Result<Self, Self::Error> {
match value {
ResponseModalities::ResponseModalitiesVariant1(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ResponseModalities {
ResponseModalitiesVariant0(Vec<ResponseModalitiesVariant0>),
ResponseModalitiesVariant1(Option<::serde_json::Value>),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ResponseFormatTextType {
#[serde(rename = "text")]
Text,
}
impl ::std::fmt::Display for ResponseFormatTextType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Text => ::std::write!(__f, "text"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ResponseFormatText {
pub r#type: ResponseFormatTextType,
}
pub type ResponseFormatJsonSchemaSchema =
::std::collections::BTreeMap<String, ::serde_json::Value>;
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct WebSearchLocation {
#[serde(skip_serializing_if = "Option::is_none")]
pub country: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub region: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub timezone: Option<String>,
}
impl ::std::fmt::Display for WebSearchContextSize {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Low => ::std::write!(__f, "low"),
Self::Medium => ::std::write!(__f, "medium"),
Self::High => ::std::write!(__f, "high"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum WebSearchContextSize {
#[serde(rename = "low")]
Low,
#[serde(rename = "medium")]
Medium,
#[serde(rename = "high")]
High,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ModelObject {
#[serde(rename = "model")]
Model,
}
impl ::std::fmt::Display for ModelObject {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Model => ::std::write!(__f, "model"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct Model {
pub id: String,
pub created: i64,
pub object: ModelObject,
pub owned_by: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ListModelsResponseObject {
#[serde(rename = "list")]
List,
}
impl ::std::fmt::Display for ListModelsResponseObject {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::List => ::std::write!(__f, "list"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ListModelsResponse {
pub object: ListModelsResponseObject,
pub data: Vec<Model>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ResponseFormatJsonSchemaType {
#[serde(rename = "json_schema")]
JsonSchema,
}
impl ::std::fmt::Display for ResponseFormatJsonSchemaType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::JsonSchema => ::std::write!(__f, "json_schema"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ResponseFormatJsonSchemaJsonSchemaStrict {
ResponseFormatJsonSchemaJsonSchemaStrictVariant0(bool),
ResponseFormatJsonSchemaJsonSchemaStrictVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<bool> for ResponseFormatJsonSchemaJsonSchemaStrict {
fn from(value: bool) -> Self {
ResponseFormatJsonSchemaJsonSchemaStrict::ResponseFormatJsonSchemaJsonSchemaStrictVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ResponseFormatJsonSchemaJsonSchemaStrict> for bool {
type Error = ResponseFormatJsonSchemaJsonSchemaStrict;
fn try_from(
value: ResponseFormatJsonSchemaJsonSchemaStrict,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ResponseFormatJsonSchemaJsonSchemaStrict::ResponseFormatJsonSchemaJsonSchemaStrictVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for ResponseFormatJsonSchemaJsonSchemaStrict
{
fn from(value: Option<::serde_json::Value>) -> Self {
ResponseFormatJsonSchemaJsonSchemaStrict::ResponseFormatJsonSchemaJsonSchemaStrictVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ResponseFormatJsonSchemaJsonSchemaStrict>
for Option<::serde_json::Value>
{
type Error = ResponseFormatJsonSchemaJsonSchemaStrict;
fn try_from(
value: ResponseFormatJsonSchemaJsonSchemaStrict,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ResponseFormatJsonSchemaJsonSchemaStrict::ResponseFormatJsonSchemaJsonSchemaStrictVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ResponseFormatJsonSchemaJsonSchema {
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub schema: Option<ResponseFormatJsonSchemaSchema>,
#[serde(skip_serializing_if = "Option::is_none")]
pub strict: Option<ResponseFormatJsonSchemaJsonSchemaStrict>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ResponseFormatJsonSchema {
pub r#type: ResponseFormatJsonSchemaType,
pub json_schema: ResponseFormatJsonSchemaJsonSchema,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ResponseFormatJsonObjectType {
#[serde(rename = "json_object")]
JsonObject,
}
impl ::std::fmt::Display for ResponseFormatJsonObjectType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::JsonObject => ::std::write!(__f, "json_object"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ResponseFormatJsonObject {
pub r#type: ResponseFormatJsonObjectType,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionFunctionCallOption {
pub name: String,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[deprecated]
pub struct ChatCompletionFunctions {
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub parameters: Option<FunctionParameters>,
}
pub type ParallelToolCalls = bool;
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionMessageCustomToolCallType {
#[serde(rename = "custom")]
Custom,
}
impl ::std::fmt::Display for ChatCompletionMessageCustomToolCallType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Custom => ::std::write!(__f, "custom"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionMessageCustomToolCallCustom {
pub name: String,
pub input: String,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionMessageCustomToolCall {
pub id: String,
pub r#type: ChatCompletionMessageCustomToolCallType,
pub custom: ChatCompletionMessageCustomToolCallCustom,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CreateChatCompletionRequestTopLogprobs {
CreateChatCompletionRequestTopLogprobsVariant0(i64),
CreateChatCompletionRequestTopLogprobsVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<i64> for CreateChatCompletionRequestTopLogprobs {
fn from(value: i64) -> Self {
CreateChatCompletionRequestTopLogprobs::CreateChatCompletionRequestTopLogprobsVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestTopLogprobs> for i64 {
type Error = CreateChatCompletionRequestTopLogprobs;
fn try_from(
value: CreateChatCompletionRequestTopLogprobs,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestTopLogprobs::CreateChatCompletionRequestTopLogprobsVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for CreateChatCompletionRequestTopLogprobs {
fn from(value: Option<::serde_json::Value>) -> Self {
CreateChatCompletionRequestTopLogprobs::CreateChatCompletionRequestTopLogprobsVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestTopLogprobs>
for Option<::serde_json::Value>
{
type Error = CreateChatCompletionRequestTopLogprobs;
fn try_from(
value: CreateChatCompletionRequestTopLogprobs,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestTopLogprobs::CreateChatCompletionRequestTopLogprobsVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CreateChatCompletionRequestTemperature {
CreateChatCompletionRequestTemperatureVariant0(f64),
CreateChatCompletionRequestTemperatureVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<f64> for CreateChatCompletionRequestTemperature {
fn from(value: f64) -> Self {
CreateChatCompletionRequestTemperature::CreateChatCompletionRequestTemperatureVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestTemperature> for f64 {
type Error = CreateChatCompletionRequestTemperature;
fn try_from(
value: CreateChatCompletionRequestTemperature,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestTemperature::CreateChatCompletionRequestTemperatureVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for CreateChatCompletionRequestTemperature {
fn from(value: Option<::serde_json::Value>) -> Self {
CreateChatCompletionRequestTemperature::CreateChatCompletionRequestTemperatureVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestTemperature>
for Option<::serde_json::Value>
{
type Error = CreateChatCompletionRequestTemperature;
fn try_from(
value: CreateChatCompletionRequestTemperature,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestTemperature::CreateChatCompletionRequestTemperatureVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CreateChatCompletionRequestTopP {
CreateChatCompletionRequestTopPVariant0(f64),
CreateChatCompletionRequestTopPVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<f64> for CreateChatCompletionRequestTopP {
fn from(value: f64) -> Self {
CreateChatCompletionRequestTopP::CreateChatCompletionRequestTopPVariant0(value)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestTopP> for f64 {
type Error = CreateChatCompletionRequestTopP;
fn try_from(
value: CreateChatCompletionRequestTopP,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestTopP::CreateChatCompletionRequestTopPVariant0(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for CreateChatCompletionRequestTopP {
fn from(value: Option<::serde_json::Value>) -> Self {
CreateChatCompletionRequestTopP::CreateChatCompletionRequestTopPVariant1(value)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestTopP> for Option<::serde_json::Value> {
type Error = CreateChatCompletionRequestTopP;
fn try_from(
value: CreateChatCompletionRequestTopP,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestTopP::CreateChatCompletionRequestTopPVariant1(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum CreateChatCompletionRequestPromptCacheRetentionVariant0 {
#[serde(rename = "in_memory")]
InMemory,
#[serde(rename = "24h")]
_24h,
}
impl ::std::fmt::Display for CreateChatCompletionRequestPromptCacheRetentionVariant0 {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::InMemory => ::std::write!(__f, "in_memory"),
Self::_24h => ::std::write!(__f, "24h"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CreateChatCompletionRequestPromptCacheRetention {
CreateChatCompletionRequestPromptCacheRetentionVariant0(
CreateChatCompletionRequestPromptCacheRetentionVariant0,
),
CreateChatCompletionRequestPromptCacheRetentionVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<CreateChatCompletionRequestPromptCacheRetentionVariant0>
for CreateChatCompletionRequestPromptCacheRetention
{
fn from(value: CreateChatCompletionRequestPromptCacheRetentionVariant0) -> Self {
CreateChatCompletionRequestPromptCacheRetention::CreateChatCompletionRequestPromptCacheRetentionVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestPromptCacheRetention>
for CreateChatCompletionRequestPromptCacheRetentionVariant0
{
type Error = CreateChatCompletionRequestPromptCacheRetention;
fn try_from(
value: CreateChatCompletionRequestPromptCacheRetention,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestPromptCacheRetention::CreateChatCompletionRequestPromptCacheRetentionVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for CreateChatCompletionRequestPromptCacheRetention
{
fn from(value: Option<::serde_json::Value>) -> Self {
CreateChatCompletionRequestPromptCacheRetention::CreateChatCompletionRequestPromptCacheRetentionVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestPromptCacheRetention>
for Option<::serde_json::Value>
{
type Error = CreateChatCompletionRequestPromptCacheRetention;
fn try_from(
value: CreateChatCompletionRequestPromptCacheRetention,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestPromptCacheRetention::CreateChatCompletionRequestPromptCacheRetentionVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestDeveloperMessageContent {
ChatCompletionRequestDeveloperMessageContentVariant0(String),
ChatCompletionRequestDeveloperMessageContentVariant1(
Vec<ChatCompletionRequestMessageContentPartText>,
),
}
impl ::std::convert::From<String> for ChatCompletionRequestDeveloperMessageContent {
fn from(value: String) -> Self {
ChatCompletionRequestDeveloperMessageContent::ChatCompletionRequestDeveloperMessageContentVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestDeveloperMessageContent> for String {
type Error = ChatCompletionRequestDeveloperMessageContent;
fn try_from(
value: ChatCompletionRequestDeveloperMessageContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestDeveloperMessageContent::ChatCompletionRequestDeveloperMessageContentVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Vec<ChatCompletionRequestMessageContentPartText>>
for ChatCompletionRequestDeveloperMessageContent
{
fn from(value: Vec<ChatCompletionRequestMessageContentPartText>) -> Self {
ChatCompletionRequestDeveloperMessageContent::ChatCompletionRequestDeveloperMessageContentVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestDeveloperMessageContent>
for Vec<ChatCompletionRequestMessageContentPartText>
{
type Error = ChatCompletionRequestDeveloperMessageContent;
fn try_from(
value: ChatCompletionRequestDeveloperMessageContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestDeveloperMessageContent::ChatCompletionRequestDeveloperMessageContentVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionRequestDeveloperMessageRole {
#[serde(rename = "developer")]
Developer,
}
impl ::std::fmt::Display for ChatCompletionRequestDeveloperMessageRole {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Developer => ::std::write!(__f, "developer"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionRequestDeveloperMessage {
pub content: ChatCompletionRequestDeveloperMessageContent,
pub role: ChatCompletionRequestDeveloperMessageRole,
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
impl ::std::convert::From<ChatCompletionRequestMessageContentPartText>
for ChatCompletionRequestSystemMessageContentPart
{
fn from(value: ChatCompletionRequestMessageContentPartText) -> Self {
ChatCompletionRequestSystemMessageContentPart::ChatCompletionRequestMessageContentPartText(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestSystemMessageContentPart>
for ChatCompletionRequestMessageContentPartText
{
type Error = ChatCompletionRequestSystemMessageContentPart;
fn try_from(
value: ChatCompletionRequestSystemMessageContentPart,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestSystemMessageContentPart::ChatCompletionRequestMessageContentPartText(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestSystemMessageContentPart {
ChatCompletionRequestMessageContentPartText(ChatCompletionRequestMessageContentPartText),
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestSystemMessageContent {
ChatCompletionRequestSystemMessageContentVariant0(String),
ChatCompletionRequestSystemMessageContentVariant1(
Vec<ChatCompletionRequestSystemMessageContentPart>,
),
}
impl ::std::convert::From<String> for ChatCompletionRequestSystemMessageContent {
fn from(value: String) -> Self {
ChatCompletionRequestSystemMessageContent::ChatCompletionRequestSystemMessageContentVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestSystemMessageContent> for String {
type Error = ChatCompletionRequestSystemMessageContent;
fn try_from(
value: ChatCompletionRequestSystemMessageContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestSystemMessageContent::ChatCompletionRequestSystemMessageContentVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Vec<ChatCompletionRequestSystemMessageContentPart>>
for ChatCompletionRequestSystemMessageContent
{
fn from(value: Vec<ChatCompletionRequestSystemMessageContentPart>) -> Self {
ChatCompletionRequestSystemMessageContent::ChatCompletionRequestSystemMessageContentVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestSystemMessageContent>
for Vec<ChatCompletionRequestSystemMessageContentPart>
{
type Error = ChatCompletionRequestSystemMessageContent;
fn try_from(
value: ChatCompletionRequestSystemMessageContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestSystemMessageContent::ChatCompletionRequestSystemMessageContentVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionRequestSystemMessageRole {
#[serde(rename = "system")]
System,
}
impl ::std::fmt::Display for ChatCompletionRequestSystemMessageRole {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::System => ::std::write!(__f, "system"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionRequestSystemMessage {
pub content: ChatCompletionRequestSystemMessageContent,
pub role: ChatCompletionRequestSystemMessageRole,
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionRequestMessageContentPartImageType {
#[serde(rename = "image_url")]
ImageUrl,
}
impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartImageType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::ImageUrl => ::std::write!(__f, "image_url"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionRequestMessageContentPartImageImageUrlDetail {
#[serde(rename = "auto")]
Auto,
#[serde(rename = "low")]
Low,
#[serde(rename = "high")]
High,
}
impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartImageImageUrlDetail {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Auto => ::std::write!(__f, "auto"),
Self::Low => ::std::write!(__f, "low"),
Self::High => ::std::write!(__f, "high"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionRequestMessageContentPartImageImageUrl {
pub url: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<ChatCompletionRequestMessageContentPartImageImageUrlDetail>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionRequestMessageContentPartImage {
pub r#type: ChatCompletionRequestMessageContentPartImageType,
pub image_url: ChatCompletionRequestMessageContentPartImageImageUrl,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionRequestMessageContentPartAudioType {
#[serde(rename = "input_audio")]
InputAudio,
}
impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartAudioType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::InputAudio => ::std::write!(__f, "input_audio"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionRequestMessageContentPartAudioInputAudioFormat {
#[serde(rename = "wav")]
Wav,
#[serde(rename = "mp3")]
Mp3,
}
impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartAudioInputAudioFormat {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Wav => ::std::write!(__f, "wav"),
Self::Mp3 => ::std::write!(__f, "mp3"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionRequestMessageContentPartAudioInputAudio {
pub data: String,
pub format: ChatCompletionRequestMessageContentPartAudioInputAudioFormat,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionRequestMessageContentPartAudio {
pub r#type: ChatCompletionRequestMessageContentPartAudioType,
pub input_audio: ChatCompletionRequestMessageContentPartAudioInputAudio,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionRequestMessageContentPartFileType {
#[serde(rename = "file")]
File,
}
impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartFileType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::File => ::std::write!(__f, "file"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionRequestMessageContentPartFileFile {
#[serde(skip_serializing_if = "Option::is_none")]
pub filename: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub file_id: Option<String>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionRequestMessageContentPartFile {
pub r#type: ChatCompletionRequestMessageContentPartFileType,
pub file: ChatCompletionRequestMessageContentPartFileFile,
}
impl ::std::convert::From<ChatCompletionRequestMessageContentPartText>
for ChatCompletionRequestUserMessageContentPart
{
fn from(value: ChatCompletionRequestMessageContentPartText) -> Self {
ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartText(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContentPart>
for ChatCompletionRequestMessageContentPartText
{
type Error = ChatCompletionRequestUserMessageContentPart;
fn try_from(
value: ChatCompletionRequestUserMessageContentPart,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartText(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ChatCompletionRequestMessageContentPartImage>
for ChatCompletionRequestUserMessageContentPart
{
fn from(value: ChatCompletionRequestMessageContentPartImage) -> Self {
ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartImage(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContentPart>
for ChatCompletionRequestMessageContentPartImage
{
type Error = ChatCompletionRequestUserMessageContentPart;
fn try_from(
value: ChatCompletionRequestUserMessageContentPart,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartImage(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ChatCompletionRequestMessageContentPartAudio>
for ChatCompletionRequestUserMessageContentPart
{
fn from(value: ChatCompletionRequestMessageContentPartAudio) -> Self {
ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartAudio(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContentPart>
for ChatCompletionRequestMessageContentPartAudio
{
type Error = ChatCompletionRequestUserMessageContentPart;
fn try_from(
value: ChatCompletionRequestUserMessageContentPart,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartAudio(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ChatCompletionRequestMessageContentPartFile>
for ChatCompletionRequestUserMessageContentPart
{
fn from(value: ChatCompletionRequestMessageContentPartFile) -> Self {
ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartFile(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContentPart>
for ChatCompletionRequestMessageContentPartFile
{
type Error = ChatCompletionRequestUserMessageContentPart;
fn try_from(
value: ChatCompletionRequestUserMessageContentPart,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestUserMessageContentPart::ChatCompletionRequestMessageContentPartFile(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestUserMessageContentPart {
ChatCompletionRequestMessageContentPartText(ChatCompletionRequestMessageContentPartText),
ChatCompletionRequestMessageContentPartImage(ChatCompletionRequestMessageContentPartImage),
ChatCompletionRequestMessageContentPartAudio(ChatCompletionRequestMessageContentPartAudio),
ChatCompletionRequestMessageContentPartFile(ChatCompletionRequestMessageContentPartFile),
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestUserMessageContent {
ChatCompletionRequestUserMessageContentVariant0(String),
ChatCompletionRequestUserMessageContentVariant1(
Vec<ChatCompletionRequestUserMessageContentPart>,
),
}
impl ::std::convert::From<String> for ChatCompletionRequestUserMessageContent {
fn from(value: String) -> Self {
ChatCompletionRequestUserMessageContent::ChatCompletionRequestUserMessageContentVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContent> for String {
type Error = ChatCompletionRequestUserMessageContent;
fn try_from(
value: ChatCompletionRequestUserMessageContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestUserMessageContent::ChatCompletionRequestUserMessageContentVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Vec<ChatCompletionRequestUserMessageContentPart>>
for ChatCompletionRequestUserMessageContent
{
fn from(value: Vec<ChatCompletionRequestUserMessageContentPart>) -> Self {
ChatCompletionRequestUserMessageContent::ChatCompletionRequestUserMessageContentVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestUserMessageContent>
for Vec<ChatCompletionRequestUserMessageContentPart>
{
type Error = ChatCompletionRequestUserMessageContent;
fn try_from(
value: ChatCompletionRequestUserMessageContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestUserMessageContent::ChatCompletionRequestUserMessageContentVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionRequestUserMessageRole {
#[serde(rename = "user")]
User,
}
impl ::std::fmt::Display for ChatCompletionRequestUserMessageRole {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::User => ::std::write!(__f, "user"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionRequestUserMessage {
pub content: ChatCompletionRequestUserMessageContent,
pub role: ChatCompletionRequestUserMessageRole,
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionRequestMessageContentPartRefusalType {
#[serde(rename = "refusal")]
Refusal,
}
impl ::std::fmt::Display for ChatCompletionRequestMessageContentPartRefusalType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Refusal => ::std::write!(__f, "refusal"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionRequestMessageContentPartRefusal {
pub r#type: ChatCompletionRequestMessageContentPartRefusalType,
pub refusal: String,
}
impl ::std::convert::From<ChatCompletionRequestMessageContentPartText>
for ChatCompletionRequestAssistantMessageContentPart
{
fn from(value: ChatCompletionRequestMessageContentPartText) -> Self {
ChatCompletionRequestAssistantMessageContentPart::ChatCompletionRequestMessageContentPartText(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContentPart>
for ChatCompletionRequestMessageContentPartText
{
type Error = ChatCompletionRequestAssistantMessageContentPart;
fn try_from(
value: ChatCompletionRequestAssistantMessageContentPart,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestAssistantMessageContentPart::ChatCompletionRequestMessageContentPartText(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ChatCompletionRequestMessageContentPartRefusal>
for ChatCompletionRequestAssistantMessageContentPart
{
fn from(value: ChatCompletionRequestMessageContentPartRefusal) -> Self {
ChatCompletionRequestAssistantMessageContentPart::ChatCompletionRequestMessageContentPartRefusal(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContentPart>
for ChatCompletionRequestMessageContentPartRefusal
{
type Error = ChatCompletionRequestAssistantMessageContentPart;
fn try_from(
value: ChatCompletionRequestAssistantMessageContentPart,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestAssistantMessageContentPart::ChatCompletionRequestMessageContentPartRefusal(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestAssistantMessageContentPart {
ChatCompletionRequestMessageContentPartText(ChatCompletionRequestMessageContentPartText),
ChatCompletionRequestMessageContentPartRefusal(
ChatCompletionRequestMessageContentPartRefusal,
),
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestAssistantMessageContentVariant0 {
ChatCompletionRequestAssistantMessageContentVariant0Variant0(String),
ChatCompletionRequestAssistantMessageContentVariant0Variant1(
Vec<ChatCompletionRequestAssistantMessageContentPart>,
),
}
impl ::std::convert::From<String> for ChatCompletionRequestAssistantMessageContentVariant0 {
fn from(value: String) -> Self {
ChatCompletionRequestAssistantMessageContentVariant0::ChatCompletionRequestAssistantMessageContentVariant0Variant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContentVariant0> for String {
type Error = ChatCompletionRequestAssistantMessageContentVariant0;
fn try_from(
value: ChatCompletionRequestAssistantMessageContentVariant0,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestAssistantMessageContentVariant0::ChatCompletionRequestAssistantMessageContentVariant0Variant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Vec<ChatCompletionRequestAssistantMessageContentPart>>
for ChatCompletionRequestAssistantMessageContentVariant0
{
fn from(value: Vec<ChatCompletionRequestAssistantMessageContentPart>) -> Self {
ChatCompletionRequestAssistantMessageContentVariant0::ChatCompletionRequestAssistantMessageContentVariant0Variant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContentVariant0>
for Vec<ChatCompletionRequestAssistantMessageContentPart>
{
type Error = ChatCompletionRequestAssistantMessageContentVariant0;
fn try_from(
value: ChatCompletionRequestAssistantMessageContentVariant0,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestAssistantMessageContentVariant0::ChatCompletionRequestAssistantMessageContentVariant0Variant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestAssistantMessageContent {
ChatCompletionRequestAssistantMessageContentVariant0(
ChatCompletionRequestAssistantMessageContentVariant0,
),
ChatCompletionRequestAssistantMessageContentVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<ChatCompletionRequestAssistantMessageContentVariant0>
for ChatCompletionRequestAssistantMessageContent
{
fn from(value: ChatCompletionRequestAssistantMessageContentVariant0) -> Self {
ChatCompletionRequestAssistantMessageContent::ChatCompletionRequestAssistantMessageContentVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContent>
for ChatCompletionRequestAssistantMessageContentVariant0
{
type Error = ChatCompletionRequestAssistantMessageContent;
fn try_from(
value: ChatCompletionRequestAssistantMessageContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestAssistantMessageContent::ChatCompletionRequestAssistantMessageContentVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for ChatCompletionRequestAssistantMessageContent
{
fn from(value: Option<::serde_json::Value>) -> Self {
ChatCompletionRequestAssistantMessageContent::ChatCompletionRequestAssistantMessageContentVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageContent>
for Option<::serde_json::Value>
{
type Error = ChatCompletionRequestAssistantMessageContent;
fn try_from(
value: ChatCompletionRequestAssistantMessageContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestAssistantMessageContent::ChatCompletionRequestAssistantMessageContentVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestAssistantMessageRefusal {
ChatCompletionRequestAssistantMessageRefusalVariant0(String),
ChatCompletionRequestAssistantMessageRefusalVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<String> for ChatCompletionRequestAssistantMessageRefusal {
fn from(value: String) -> Self {
ChatCompletionRequestAssistantMessageRefusal::ChatCompletionRequestAssistantMessageRefusalVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageRefusal> for String {
type Error = ChatCompletionRequestAssistantMessageRefusal;
fn try_from(
value: ChatCompletionRequestAssistantMessageRefusal,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestAssistantMessageRefusal::ChatCompletionRequestAssistantMessageRefusalVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for ChatCompletionRequestAssistantMessageRefusal
{
fn from(value: Option<::serde_json::Value>) -> Self {
ChatCompletionRequestAssistantMessageRefusal::ChatCompletionRequestAssistantMessageRefusalVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageRefusal>
for Option<::serde_json::Value>
{
type Error = ChatCompletionRequestAssistantMessageRefusal;
fn try_from(
value: ChatCompletionRequestAssistantMessageRefusal,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestAssistantMessageRefusal::ChatCompletionRequestAssistantMessageRefusalVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionRequestAssistantMessageRole {
#[serde(rename = "assistant")]
Assistant,
}
impl ::std::fmt::Display for ChatCompletionRequestAssistantMessageRole {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Assistant => ::std::write!(__f, "assistant"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionRequestAssistantMessageAudioVariant0 {
pub id: String,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestAssistantMessageAudio {
ChatCompletionRequestAssistantMessageAudioVariant0(
ChatCompletionRequestAssistantMessageAudioVariant0,
),
ChatCompletionRequestAssistantMessageAudioVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<ChatCompletionRequestAssistantMessageAudioVariant0>
for ChatCompletionRequestAssistantMessageAudio
{
fn from(value: ChatCompletionRequestAssistantMessageAudioVariant0) -> Self {
ChatCompletionRequestAssistantMessageAudio::ChatCompletionRequestAssistantMessageAudioVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageAudio>
for ChatCompletionRequestAssistantMessageAudioVariant0
{
type Error = ChatCompletionRequestAssistantMessageAudio;
fn try_from(
value: ChatCompletionRequestAssistantMessageAudio,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestAssistantMessageAudio::ChatCompletionRequestAssistantMessageAudioVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for ChatCompletionRequestAssistantMessageAudio
{
fn from(value: Option<::serde_json::Value>) -> Self {
ChatCompletionRequestAssistantMessageAudio::ChatCompletionRequestAssistantMessageAudioVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageAudio>
for Option<::serde_json::Value>
{
type Error = ChatCompletionRequestAssistantMessageAudio;
fn try_from(
value: ChatCompletionRequestAssistantMessageAudio,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestAssistantMessageAudio::ChatCompletionRequestAssistantMessageAudioVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionMessageToolCallType {
#[serde(rename = "function")]
Function,
}
impl ::std::fmt::Display for ChatCompletionMessageToolCallType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Function => ::std::write!(__f, "function"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionMessageToolCallFunction {
pub name: String,
pub arguments: String,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionMessageToolCall {
pub id: String,
pub r#type: ChatCompletionMessageToolCallType,
pub function: ChatCompletionMessageToolCallFunction,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionMessageToolCallsItem {
ChatCompletionMessageToolCall(ChatCompletionMessageToolCall),
ChatCompletionMessageCustomToolCall(ChatCompletionMessageCustomToolCall),
}
impl ::std::convert::From<ChatCompletionMessageToolCall> for ChatCompletionMessageToolCallsItem {
fn from(value: ChatCompletionMessageToolCall) -> Self {
ChatCompletionMessageToolCallsItem::ChatCompletionMessageToolCall(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionMessageToolCallsItem> for ChatCompletionMessageToolCall {
type Error = ChatCompletionMessageToolCallsItem;
fn try_from(
value: ChatCompletionMessageToolCallsItem,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionMessageToolCallsItem::ChatCompletionMessageToolCall(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ChatCompletionMessageCustomToolCall>
for ChatCompletionMessageToolCallsItem
{
fn from(value: ChatCompletionMessageCustomToolCall) -> Self {
ChatCompletionMessageToolCallsItem::ChatCompletionMessageCustomToolCall(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionMessageToolCallsItem>
for ChatCompletionMessageCustomToolCall
{
type Error = ChatCompletionMessageToolCallsItem;
fn try_from(
value: ChatCompletionMessageToolCallsItem,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionMessageToolCallsItem::ChatCompletionMessageCustomToolCall(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
pub type ChatCompletionMessageToolCalls = Vec<ChatCompletionMessageToolCallsItem>;
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[deprecated]
pub struct ChatCompletionRequestAssistantMessageFunctionCallVariant0 {
pub arguments: String,
pub name: String,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestAssistantMessageFunctionCall {
ChatCompletionRequestAssistantMessageFunctionCallVariant0(
ChatCompletionRequestAssistantMessageFunctionCallVariant0,
),
ChatCompletionRequestAssistantMessageFunctionCallVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<ChatCompletionRequestAssistantMessageFunctionCallVariant0>
for ChatCompletionRequestAssistantMessageFunctionCall
{
fn from(value: ChatCompletionRequestAssistantMessageFunctionCallVariant0) -> Self {
ChatCompletionRequestAssistantMessageFunctionCall::ChatCompletionRequestAssistantMessageFunctionCallVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageFunctionCall>
for ChatCompletionRequestAssistantMessageFunctionCallVariant0
{
type Error = ChatCompletionRequestAssistantMessageFunctionCall;
fn try_from(
value: ChatCompletionRequestAssistantMessageFunctionCall,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestAssistantMessageFunctionCall::ChatCompletionRequestAssistantMessageFunctionCallVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for ChatCompletionRequestAssistantMessageFunctionCall
{
fn from(value: Option<::serde_json::Value>) -> Self {
ChatCompletionRequestAssistantMessageFunctionCall::ChatCompletionRequestAssistantMessageFunctionCallVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestAssistantMessageFunctionCall>
for Option<::serde_json::Value>
{
type Error = ChatCompletionRequestAssistantMessageFunctionCall;
fn try_from(
value: ChatCompletionRequestAssistantMessageFunctionCall,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestAssistantMessageFunctionCall::ChatCompletionRequestAssistantMessageFunctionCallVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionRequestAssistantMessage {
#[serde(skip_serializing_if = "Option::is_none")]
pub content: Option<ChatCompletionRequestAssistantMessageContent>,
#[serde(skip_serializing_if = "Option::is_none")]
pub refusal: Option<ChatCompletionRequestAssistantMessageRefusal>,
pub role: ChatCompletionRequestAssistantMessageRole,
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub audio: Option<ChatCompletionRequestAssistantMessageAudio>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tool_calls: Option<ChatCompletionMessageToolCalls>,
#[serde(skip_serializing_if = "Option::is_none")]
pub function_call: Option<ChatCompletionRequestAssistantMessageFunctionCall>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reasoning_content: Option<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionRequestToolMessageRole {
#[serde(rename = "tool")]
Tool,
}
impl ::std::fmt::Display for ChatCompletionRequestToolMessageRole {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Tool => ::std::write!(__f, "tool"),
}
}
}
impl ::std::convert::From<ChatCompletionRequestMessageContentPartText>
for ChatCompletionRequestToolMessageContentPart
{
fn from(value: ChatCompletionRequestMessageContentPartText) -> Self {
ChatCompletionRequestToolMessageContentPart::ChatCompletionRequestMessageContentPartText(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestToolMessageContentPart>
for ChatCompletionRequestMessageContentPartText
{
type Error = ChatCompletionRequestToolMessageContentPart;
fn try_from(
value: ChatCompletionRequestToolMessageContentPart,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestToolMessageContentPart::ChatCompletionRequestMessageContentPartText(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestToolMessageContentPart {
ChatCompletionRequestMessageContentPartText(ChatCompletionRequestMessageContentPartText),
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestToolMessageContent {
ChatCompletionRequestToolMessageContentVariant0(String),
ChatCompletionRequestToolMessageContentVariant1(
Vec<ChatCompletionRequestToolMessageContentPart>,
),
}
impl ::std::convert::From<String> for ChatCompletionRequestToolMessageContent {
fn from(value: String) -> Self {
ChatCompletionRequestToolMessageContent::ChatCompletionRequestToolMessageContentVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestToolMessageContent> for String {
type Error = ChatCompletionRequestToolMessageContent;
fn try_from(
value: ChatCompletionRequestToolMessageContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestToolMessageContent::ChatCompletionRequestToolMessageContentVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Vec<ChatCompletionRequestToolMessageContentPart>>
for ChatCompletionRequestToolMessageContent
{
fn from(value: Vec<ChatCompletionRequestToolMessageContentPart>) -> Self {
ChatCompletionRequestToolMessageContent::ChatCompletionRequestToolMessageContentVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestToolMessageContent>
for Vec<ChatCompletionRequestToolMessageContentPart>
{
type Error = ChatCompletionRequestToolMessageContent;
fn try_from(
value: ChatCompletionRequestToolMessageContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestToolMessageContent::ChatCompletionRequestToolMessageContentVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionRequestToolMessage {
pub role: ChatCompletionRequestToolMessageRole,
pub content: ChatCompletionRequestToolMessageContent,
pub tool_call_id: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionRequestFunctionMessageRole {
#[serde(rename = "function")]
Function,
}
impl ::std::fmt::Display for ChatCompletionRequestFunctionMessageRole {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Function => ::std::write!(__f, "function"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestFunctionMessageContent {
ChatCompletionRequestFunctionMessageContentVariant0(String),
ChatCompletionRequestFunctionMessageContentVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<String> for ChatCompletionRequestFunctionMessageContent {
fn from(value: String) -> Self {
ChatCompletionRequestFunctionMessageContent::ChatCompletionRequestFunctionMessageContentVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestFunctionMessageContent> for String {
type Error = ChatCompletionRequestFunctionMessageContent;
fn try_from(
value: ChatCompletionRequestFunctionMessageContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestFunctionMessageContent::ChatCompletionRequestFunctionMessageContentVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for ChatCompletionRequestFunctionMessageContent
{
fn from(value: Option<::serde_json::Value>) -> Self {
ChatCompletionRequestFunctionMessageContent::ChatCompletionRequestFunctionMessageContentVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestFunctionMessageContent>
for Option<::serde_json::Value>
{
type Error = ChatCompletionRequestFunctionMessageContent;
fn try_from(
value: ChatCompletionRequestFunctionMessageContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestFunctionMessageContent::ChatCompletionRequestFunctionMessageContentVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[deprecated]
pub struct ChatCompletionRequestFunctionMessage {
pub role: ChatCompletionRequestFunctionMessageRole,
pub content: ChatCompletionRequestFunctionMessageContent,
pub name: String,
}
impl ::std::convert::From<ChatCompletionRequestDeveloperMessage> for ChatCompletionRequestMessage {
fn from(value: ChatCompletionRequestDeveloperMessage) -> Self {
ChatCompletionRequestMessage::ChatCompletionRequestDeveloperMessage(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestMessage>
for ChatCompletionRequestDeveloperMessage
{
type Error = ChatCompletionRequestMessage;
fn try_from(
value: ChatCompletionRequestMessage,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestMessage::ChatCompletionRequestDeveloperMessage(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ChatCompletionRequestSystemMessage> for ChatCompletionRequestMessage {
fn from(value: ChatCompletionRequestSystemMessage) -> Self {
ChatCompletionRequestMessage::ChatCompletionRequestSystemMessage(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestMessage> for ChatCompletionRequestSystemMessage {
type Error = ChatCompletionRequestMessage;
fn try_from(
value: ChatCompletionRequestMessage,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestMessage::ChatCompletionRequestSystemMessage(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ChatCompletionRequestUserMessage> for ChatCompletionRequestMessage {
fn from(value: ChatCompletionRequestUserMessage) -> Self {
ChatCompletionRequestMessage::ChatCompletionRequestUserMessage(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestMessage> for ChatCompletionRequestUserMessage {
type Error = ChatCompletionRequestMessage;
fn try_from(
value: ChatCompletionRequestMessage,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestMessage::ChatCompletionRequestUserMessage(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ChatCompletionRequestAssistantMessage> for ChatCompletionRequestMessage {
fn from(value: ChatCompletionRequestAssistantMessage) -> Self {
ChatCompletionRequestMessage::ChatCompletionRequestAssistantMessage(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestMessage>
for ChatCompletionRequestAssistantMessage
{
type Error = ChatCompletionRequestMessage;
fn try_from(
value: ChatCompletionRequestMessage,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestMessage::ChatCompletionRequestAssistantMessage(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ChatCompletionRequestToolMessage> for ChatCompletionRequestMessage {
fn from(value: ChatCompletionRequestToolMessage) -> Self {
ChatCompletionRequestMessage::ChatCompletionRequestToolMessage(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestMessage> for ChatCompletionRequestToolMessage {
type Error = ChatCompletionRequestMessage;
fn try_from(
value: ChatCompletionRequestMessage,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestMessage::ChatCompletionRequestToolMessage(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ChatCompletionRequestFunctionMessage> for ChatCompletionRequestMessage {
fn from(value: ChatCompletionRequestFunctionMessage) -> Self {
ChatCompletionRequestMessage::ChatCompletionRequestFunctionMessage(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionRequestMessage>
for ChatCompletionRequestFunctionMessage
{
type Error = ChatCompletionRequestMessage;
fn try_from(
value: ChatCompletionRequestMessage,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionRequestMessage::ChatCompletionRequestFunctionMessage(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionRequestMessage {
ChatCompletionRequestDeveloperMessage(ChatCompletionRequestDeveloperMessage),
ChatCompletionRequestSystemMessage(ChatCompletionRequestSystemMessage),
ChatCompletionRequestUserMessage(ChatCompletionRequestUserMessage),
ChatCompletionRequestAssistantMessage(ChatCompletionRequestAssistantMessage),
ChatCompletionRequestToolMessage(ChatCompletionRequestToolMessage),
ChatCompletionRequestFunctionMessage(ChatCompletionRequestFunctionMessage),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum CreateChatCompletionRequestWebSearchOptionsUserLocationType {
#[serde(rename = "approximate")]
Approximate,
}
impl ::std::fmt::Display for CreateChatCompletionRequestWebSearchOptionsUserLocationType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Approximate => ::std::write!(__f, "approximate"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CreateChatCompletionRequestWebSearchOptionsUserLocation {
pub r#type: CreateChatCompletionRequestWebSearchOptionsUserLocationType,
pub approximate: WebSearchLocation,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CreateChatCompletionRequestWebSearchOptions {
#[serde(skip_serializing_if = "Option::is_none")]
pub user_location: Option<CreateChatCompletionRequestWebSearchOptionsUserLocation>,
#[serde(skip_serializing_if = "Option::is_none")]
pub search_context_size: Option<WebSearchContextSize>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CreateChatCompletionRequestResponseFormat {
ResponseFormatText(ResponseFormatText),
ResponseFormatJsonSchema(ResponseFormatJsonSchema),
ResponseFormatJsonObject(ResponseFormatJsonObject),
}
impl ::std::convert::From<ResponseFormatText> for CreateChatCompletionRequestResponseFormat {
fn from(value: ResponseFormatText) -> Self {
CreateChatCompletionRequestResponseFormat::ResponseFormatText(value)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestResponseFormat> for ResponseFormatText {
type Error = CreateChatCompletionRequestResponseFormat;
fn try_from(
value: CreateChatCompletionRequestResponseFormat,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestResponseFormat::ResponseFormatText(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ResponseFormatJsonSchema> for CreateChatCompletionRequestResponseFormat {
fn from(value: ResponseFormatJsonSchema) -> Self {
CreateChatCompletionRequestResponseFormat::ResponseFormatJsonSchema(value)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestResponseFormat>
for ResponseFormatJsonSchema
{
type Error = CreateChatCompletionRequestResponseFormat;
fn try_from(
value: CreateChatCompletionRequestResponseFormat,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestResponseFormat::ResponseFormatJsonSchema(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ResponseFormatJsonObject> for CreateChatCompletionRequestResponseFormat {
fn from(value: ResponseFormatJsonObject) -> Self {
CreateChatCompletionRequestResponseFormat::ResponseFormatJsonObject(value)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestResponseFormat>
for ResponseFormatJsonObject
{
type Error = CreateChatCompletionRequestResponseFormat;
fn try_from(
value: CreateChatCompletionRequestResponseFormat,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestResponseFormat::ResponseFormatJsonObject(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum CreateChatCompletionRequestAudioFormat {
#[serde(rename = "wav")]
Wav,
#[serde(rename = "aac")]
Aac,
#[serde(rename = "mp3")]
Mp3,
#[serde(rename = "flac")]
Flac,
#[serde(rename = "opus")]
Opus,
#[serde(rename = "pcm16")]
Pcm16,
}
impl ::std::fmt::Display for CreateChatCompletionRequestAudioFormat {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Wav => ::std::write!(__f, "wav"),
Self::Aac => ::std::write!(__f, "aac"),
Self::Mp3 => ::std::write!(__f, "mp3"),
Self::Flac => ::std::write!(__f, "flac"),
Self::Opus => ::std::write!(__f, "opus"),
Self::Pcm16 => ::std::write!(__f, "pcm16"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CreateChatCompletionRequestAudio {
pub voice: VoiceIdsOrCustomVoice,
pub format: CreateChatCompletionRequestAudioFormat,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CreateChatCompletionRequestPrediction {
PredictionContent(PredictionContent),
}
impl ::std::convert::From<PredictionContent> for CreateChatCompletionRequestPrediction {
fn from(value: PredictionContent) -> Self {
CreateChatCompletionRequestPrediction::PredictionContent(value)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestPrediction> for PredictionContent {
type Error = CreateChatCompletionRequestPrediction;
fn try_from(
value: CreateChatCompletionRequestPrediction,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestPrediction::PredictionContent(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CreateChatCompletionRequestTools {
ChatCompletionTool(ChatCompletionTool),
CustomToolChatCompletions(CustomToolChatCompletions),
}
impl ::std::convert::From<ChatCompletionTool> for CreateChatCompletionRequestTools {
fn from(value: ChatCompletionTool) -> Self {
CreateChatCompletionRequestTools::ChatCompletionTool(value)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestTools> for ChatCompletionTool {
type Error = CreateChatCompletionRequestTools;
fn try_from(
value: CreateChatCompletionRequestTools,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestTools::ChatCompletionTool(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<CustomToolChatCompletions> for CreateChatCompletionRequestTools {
fn from(value: CustomToolChatCompletions) -> Self {
CreateChatCompletionRequestTools::CustomToolChatCompletions(value)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestTools> for CustomToolChatCompletions {
type Error = CreateChatCompletionRequestTools;
fn try_from(
value: CreateChatCompletionRequestTools,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestTools::CustomToolChatCompletions(inner) => {
::std::result::Result::Ok(inner)
}
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum CreateChatCompletionRequestFunctionCallVariant0 {
#[serde(rename = "none")]
None,
#[serde(rename = "auto")]
Auto,
}
impl ::std::fmt::Display for CreateChatCompletionRequestFunctionCallVariant0 {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::None => ::std::write!(__f, "none"),
Self::Auto => ::std::write!(__f, "auto"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
#[deprecated]
pub enum CreateChatCompletionRequestFunctionCall {
CreateChatCompletionRequestFunctionCallVariant0(
CreateChatCompletionRequestFunctionCallVariant0,
),
ChatCompletionFunctionCallOption(ChatCompletionFunctionCallOption),
}
impl ::std::convert::From<CreateChatCompletionRequestFunctionCallVariant0>
for CreateChatCompletionRequestFunctionCall
{
fn from(value: CreateChatCompletionRequestFunctionCallVariant0) -> Self {
CreateChatCompletionRequestFunctionCall::CreateChatCompletionRequestFunctionCallVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestFunctionCall>
for CreateChatCompletionRequestFunctionCallVariant0
{
type Error = CreateChatCompletionRequestFunctionCall;
fn try_from(
value: CreateChatCompletionRequestFunctionCall,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestFunctionCall::CreateChatCompletionRequestFunctionCallVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<ChatCompletionFunctionCallOption>
for CreateChatCompletionRequestFunctionCall
{
fn from(value: ChatCompletionFunctionCallOption) -> Self {
CreateChatCompletionRequestFunctionCall::ChatCompletionFunctionCallOption(value)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionRequestFunctionCall>
for ChatCompletionFunctionCallOption
{
type Error = CreateChatCompletionRequestFunctionCall;
fn try_from(
value: CreateChatCompletionRequestFunctionCall,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionRequestFunctionCall::ChatCompletionFunctionCallOption(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CreateChatCompletionRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<Metadata>,
#[serde(skip_serializing_if = "Option::is_none")]
pub top_logprobs: Option<CreateChatCompletionRequestTopLogprobs>,
#[serde(skip_serializing_if = "Option::is_none")]
pub temperature: Option<CreateChatCompletionRequestTemperature>,
#[serde(skip_serializing_if = "Option::is_none")]
pub top_p: Option<CreateChatCompletionRequestTopP>,
#[serde(skip_serializing_if = "Option::is_none")]
#[deprecated]
pub user: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_identifier: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_cache_key: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub service_tier: Option<ServiceTier>,
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_cache_retention: Option<CreateChatCompletionRequestPromptCacheRetention>,
pub messages: Vec<ChatCompletionRequestMessage>,
pub model: ModelIdsShared,
#[serde(skip_serializing_if = "Option::is_none")]
pub modalities: Option<ResponseModalities>,
#[serde(skip_serializing_if = "Option::is_none")]
pub verbosity: Option<Verbosity>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reasoning_effort: Option<ReasoningEffort>,
#[serde(skip_serializing_if = "Option::is_none")]
pub max_completion_tokens: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub frequency_penalty: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub presence_penalty: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub web_search_options: Option<CreateChatCompletionRequestWebSearchOptions>,
#[serde(skip_serializing_if = "Option::is_none")]
pub response_format: Option<CreateChatCompletionRequestResponseFormat>,
#[serde(skip_serializing_if = "Option::is_none")]
pub audio: Option<CreateChatCompletionRequestAudio>,
#[serde(skip_serializing_if = "Option::is_none")]
pub store: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub stream: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub stop: Option<StopConfiguration>,
#[serde(skip_serializing_if = "Option::is_none")]
pub logit_bias: Option<::std::collections::BTreeMap<String, i64>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub logprobs: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
#[deprecated]
pub max_tokens: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub n: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub prediction: Option<CreateChatCompletionRequestPrediction>,
#[serde(skip_serializing_if = "Option::is_none")]
#[deprecated]
pub seed: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub stream_options: Option<ChatCompletionStreamOptions>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tools: Option<Vec<CreateChatCompletionRequestTools>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tool_choice: Option<ChatCompletionToolChoiceOption>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parallel_tool_calls: Option<ParallelToolCalls>,
#[serde(skip_serializing_if = "Option::is_none")]
#[deprecated]
pub function_call: Option<CreateChatCompletionRequestFunctionCall>,
#[serde(skip_serializing_if = "Option::is_none")]
#[deprecated]
pub functions: Option<Vec<ChatCompletionFunctions>>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum CreateChatCompletionResponseChoicesFinishReason {
#[serde(rename = "stop")]
Stop,
#[serde(rename = "length")]
Length,
#[serde(rename = "tool_calls")]
ToolCalls,
#[serde(rename = "content_filter")]
ContentFilter,
#[serde(rename = "function_call")]
FunctionCall,
}
impl ::std::fmt::Display for CreateChatCompletionResponseChoicesFinishReason {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Stop => ::std::write!(__f, "stop"),
Self::Length => ::std::write!(__f, "length"),
Self::ToolCalls => ::std::write!(__f, "tool_calls"),
Self::ContentFilter => ::std::write!(__f, "content_filter"),
Self::FunctionCall => ::std::write!(__f, "function_call"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionResponseMessageContent {
ChatCompletionResponseMessageContentVariant0(String),
ChatCompletionResponseMessageContentVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<String> for ChatCompletionResponseMessageContent {
fn from(value: String) -> Self {
ChatCompletionResponseMessageContent::ChatCompletionResponseMessageContentVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionResponseMessageContent> for String {
type Error = ChatCompletionResponseMessageContent;
fn try_from(
value: ChatCompletionResponseMessageContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionResponseMessageContent::ChatCompletionResponseMessageContentVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionResponseMessageContent {
fn from(value: Option<::serde_json::Value>) -> Self {
ChatCompletionResponseMessageContent::ChatCompletionResponseMessageContentVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionResponseMessageContent> for Option<::serde_json::Value> {
type Error = ChatCompletionResponseMessageContent;
fn try_from(
value: ChatCompletionResponseMessageContent,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionResponseMessageContent::ChatCompletionResponseMessageContentVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionResponseMessageRefusal {
ChatCompletionResponseMessageRefusalVariant0(String),
ChatCompletionResponseMessageRefusalVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<String> for ChatCompletionResponseMessageRefusal {
fn from(value: String) -> Self {
ChatCompletionResponseMessageRefusal::ChatCompletionResponseMessageRefusalVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionResponseMessageRefusal> for String {
type Error = ChatCompletionResponseMessageRefusal;
fn try_from(
value: ChatCompletionResponseMessageRefusal,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionResponseMessageRefusal::ChatCompletionResponseMessageRefusalVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionResponseMessageRefusal {
fn from(value: Option<::serde_json::Value>) -> Self {
ChatCompletionResponseMessageRefusal::ChatCompletionResponseMessageRefusalVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<ChatCompletionResponseMessageRefusal> for Option<::serde_json::Value> {
type Error = ChatCompletionResponseMessageRefusal;
fn try_from(
value: ChatCompletionResponseMessageRefusal,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionResponseMessageRefusal::ChatCompletionResponseMessageRefusalVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionResponseMessageAnnotationsType {
#[serde(rename = "url_citation")]
UrlCitation,
}
impl ::std::fmt::Display for ChatCompletionResponseMessageAnnotationsType {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::UrlCitation => ::std::write!(__f, "url_citation"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionResponseMessageAnnotationsUrlCitation {
pub end_index: i64,
pub start_index: i64,
pub url: String,
pub title: String,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionResponseMessageAnnotations {
pub r#type: ChatCompletionResponseMessageAnnotationsType,
pub url_citation: ChatCompletionResponseMessageAnnotationsUrlCitation,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum ChatCompletionResponseMessageRole {
#[serde(rename = "assistant")]
Assistant,
}
impl ::std::fmt::Display for ChatCompletionResponseMessageRole {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::Assistant => ::std::write!(__f, "assistant"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[deprecated]
pub struct ChatCompletionResponseMessageFunctionCall {
pub arguments: String,
pub name: String,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionResponseMessageAudioVariant0 {
pub id: String,
pub expires_at: i64,
pub data: String,
pub transcript: String,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum ChatCompletionResponseMessageAudio {
ChatCompletionResponseMessageAudioVariant0(ChatCompletionResponseMessageAudioVariant0),
ChatCompletionResponseMessageAudioVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<ChatCompletionResponseMessageAudioVariant0>
for ChatCompletionResponseMessageAudio
{
fn from(value: ChatCompletionResponseMessageAudioVariant0) -> Self {
ChatCompletionResponseMessageAudio::ChatCompletionResponseMessageAudioVariant0(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionResponseMessageAudio>
for ChatCompletionResponseMessageAudioVariant0
{
type Error = ChatCompletionResponseMessageAudio;
fn try_from(
value: ChatCompletionResponseMessageAudio,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionResponseMessageAudio::ChatCompletionResponseMessageAudioVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>> for ChatCompletionResponseMessageAudio {
fn from(value: Option<::serde_json::Value>) -> Self {
ChatCompletionResponseMessageAudio::ChatCompletionResponseMessageAudioVariant1(value)
}
}
impl ::std::convert::TryFrom<ChatCompletionResponseMessageAudio> for Option<::serde_json::Value> {
type Error = ChatCompletionResponseMessageAudio;
fn try_from(
value: ChatCompletionResponseMessageAudio,
) -> ::std::result::Result<Self, Self::Error> {
match value {
ChatCompletionResponseMessageAudio::ChatCompletionResponseMessageAudioVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct ChatCompletionResponseMessage {
pub content: ChatCompletionResponseMessageContent,
pub refusal: ChatCompletionResponseMessageRefusal,
#[serde(skip_serializing_if = "Option::is_none")]
pub tool_calls: Option<ChatCompletionMessageToolCalls>,
#[serde(skip_serializing_if = "Option::is_none")]
pub annotations: Option<Vec<ChatCompletionResponseMessageAnnotations>>,
pub role: ChatCompletionResponseMessageRole,
#[serde(skip_serializing_if = "Option::is_none")]
#[deprecated]
pub function_call: Option<ChatCompletionResponseMessageFunctionCall>,
#[serde(skip_serializing_if = "Option::is_none")]
pub audio: Option<ChatCompletionResponseMessageAudio>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CreateChatCompletionResponseChoicesLogprobsVariant0Content {
CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant0(
Vec<ChatCompletionTokenLogprob>,
),
CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant1(
Option<::serde_json::Value>,
),
}
impl ::std::convert::From<Vec<ChatCompletionTokenLogprob>>
for CreateChatCompletionResponseChoicesLogprobsVariant0Content
{
fn from(value: Vec<ChatCompletionTokenLogprob>) -> Self {
CreateChatCompletionResponseChoicesLogprobsVariant0Content::CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobsVariant0Content>
for Vec<ChatCompletionTokenLogprob>
{
type Error = CreateChatCompletionResponseChoicesLogprobsVariant0Content;
fn try_from(
value: CreateChatCompletionResponseChoicesLogprobsVariant0Content,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionResponseChoicesLogprobsVariant0Content::CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for CreateChatCompletionResponseChoicesLogprobsVariant0Content
{
fn from(value: Option<::serde_json::Value>) -> Self {
CreateChatCompletionResponseChoicesLogprobsVariant0Content::CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobsVariant0Content>
for Option<::serde_json::Value>
{
type Error = CreateChatCompletionResponseChoicesLogprobsVariant0Content;
fn try_from(
value: CreateChatCompletionResponseChoicesLogprobsVariant0Content,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionResponseChoicesLogprobsVariant0Content::CreateChatCompletionResponseChoicesLogprobsVariant0ContentVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CreateChatCompletionResponseChoicesLogprobsVariant0Refusal {
CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant0(
Vec<ChatCompletionTokenLogprob>,
),
CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant1(
Option<::serde_json::Value>,
),
}
impl ::std::convert::From<Vec<ChatCompletionTokenLogprob>>
for CreateChatCompletionResponseChoicesLogprobsVariant0Refusal
{
fn from(value: Vec<ChatCompletionTokenLogprob>) -> Self {
CreateChatCompletionResponseChoicesLogprobsVariant0Refusal::CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobsVariant0Refusal>
for Vec<ChatCompletionTokenLogprob>
{
type Error = CreateChatCompletionResponseChoicesLogprobsVariant0Refusal;
fn try_from(
value: CreateChatCompletionResponseChoicesLogprobsVariant0Refusal,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionResponseChoicesLogprobsVariant0Refusal::CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for CreateChatCompletionResponseChoicesLogprobsVariant0Refusal
{
fn from(value: Option<::serde_json::Value>) -> Self {
CreateChatCompletionResponseChoicesLogprobsVariant0Refusal::CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobsVariant0Refusal>
for Option<::serde_json::Value>
{
type Error = CreateChatCompletionResponseChoicesLogprobsVariant0Refusal;
fn try_from(
value: CreateChatCompletionResponseChoicesLogprobsVariant0Refusal,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionResponseChoicesLogprobsVariant0Refusal::CreateChatCompletionResponseChoicesLogprobsVariant0RefusalVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CreateChatCompletionResponseChoicesLogprobsVariant0 {
pub content: CreateChatCompletionResponseChoicesLogprobsVariant0Content,
pub refusal: CreateChatCompletionResponseChoicesLogprobsVariant0Refusal,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
#[serde(untagged)]
pub enum CreateChatCompletionResponseChoicesLogprobs {
CreateChatCompletionResponseChoicesLogprobsVariant0(
CreateChatCompletionResponseChoicesLogprobsVariant0,
),
CreateChatCompletionResponseChoicesLogprobsVariant1(Option<::serde_json::Value>),
}
impl ::std::convert::From<CreateChatCompletionResponseChoicesLogprobsVariant0>
for CreateChatCompletionResponseChoicesLogprobs
{
fn from(value: CreateChatCompletionResponseChoicesLogprobsVariant0) -> Self {
CreateChatCompletionResponseChoicesLogprobs::CreateChatCompletionResponseChoicesLogprobsVariant0(
value,
)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobs>
for CreateChatCompletionResponseChoicesLogprobsVariant0
{
type Error = CreateChatCompletionResponseChoicesLogprobs;
fn try_from(
value: CreateChatCompletionResponseChoicesLogprobs,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionResponseChoicesLogprobs::CreateChatCompletionResponseChoicesLogprobsVariant0(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
impl ::std::convert::From<Option<::serde_json::Value>>
for CreateChatCompletionResponseChoicesLogprobs
{
fn from(value: Option<::serde_json::Value>) -> Self {
CreateChatCompletionResponseChoicesLogprobs::CreateChatCompletionResponseChoicesLogprobsVariant1(
value,
)
}
}
impl ::std::convert::TryFrom<CreateChatCompletionResponseChoicesLogprobs>
for Option<::serde_json::Value>
{
type Error = CreateChatCompletionResponseChoicesLogprobs;
fn try_from(
value: CreateChatCompletionResponseChoicesLogprobs,
) -> ::std::result::Result<Self, Self::Error> {
match value {
CreateChatCompletionResponseChoicesLogprobs::CreateChatCompletionResponseChoicesLogprobsVariant1(
inner,
) => ::std::result::Result::Ok(inner),
other => ::std::result::Result::Err(other),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CreateChatCompletionResponseChoices {
pub finish_reason: CreateChatCompletionResponseChoicesFinishReason,
pub index: i64,
pub message: ChatCompletionResponseMessage,
pub logprobs: CreateChatCompletionResponseChoicesLogprobs,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ::serde::Serialize, ::serde::Deserialize)]
pub enum CreateChatCompletionResponseObject {
#[serde(rename = "chat.completion")]
ChatCompletion,
}
impl ::std::fmt::Display for CreateChatCompletionResponseObject {
fn fmt(&self, __f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::ChatCompletion => ::std::write!(__f, "chat.completion"),
}
}
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct CreateChatCompletionResponse {
pub id: String,
pub choices: Vec<CreateChatCompletionResponseChoices>,
pub created: i64,
pub model: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub service_tier: Option<ServiceTier>,
#[serde(skip_serializing_if = "Option::is_none")]
#[deprecated]
pub system_fingerprint: Option<String>,
pub object: CreateChatCompletionResponseObject,
#[serde(skip_serializing_if = "Option::is_none")]
pub usage: Option<CompletionUsage>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct OpenAiErrorResponseError {
pub message: String,
pub r#type: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub param: Option<String>,
}
#[derive(Debug, Clone, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
pub struct OpenAiErrorResponse {
pub error: OpenAiErrorResponseError,
}
}
pub mod operations {
#![allow(deprecated)]
#![allow(unreachable_patterns)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(clippy::all, clippy::pedantic)]
pub mod models {
pub mod get {
#[derive(Debug, Clone, PartialEq)]
pub struct Request {}
impl Request {
pub const METHOD: ::http::Method = ::http::Method::GET;
pub const PATH_TEMPLATE: &'static str = "/models";
pub const SECURITY: &'static [&'static [&'static str]] = &[&["ApiKeyAuth"]];
pub fn with_accept(self, accept: ::http::HeaderValue) -> ::toac::WithAccept<Self> {
::toac::WithAccept::new(self, accept)
}
}
impl ::toac::MakeRequest for Request {
type Error = ::std::convert::Infallible;
fn make_request(
self,
) -> impl ::std::future::Future<
Output = ::std::result::Result<::toac::Request, Self::Error>,
> + Send {
async move {
let mut __path = ::std::string::String::new();
__path.push_str("/models");
let mut __builder = ::http::Request::builder()
.method(::http::Method::GET)
.uri(__path);
__builder = __builder.header(
::http::header::ACCEPT,
::http::HeaderValue::from_static("application/json"),
);
let mut __request = __builder
.body(::toac::body::Body::empty())
.expect("valid generated HTTP request");
__request
.extensions_mut()
.insert(::toac::OperationSecurity(&[&["ApiKeyAuth"]]));
::std::result::Result::Ok(__request)
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum ResponseBody {
Status200(crate::wire::openai::components::ListModelsResponse),
Status400(crate::wire::openai::components::OpenAiErrorResponse),
Status401(crate::wire::openai::components::OpenAiErrorResponse),
Status403(crate::wire::openai::components::OpenAiErrorResponse),
Status404(crate::wire::openai::components::OpenAiErrorResponse),
Status413(crate::wire::openai::components::OpenAiErrorResponse),
Status429(crate::wire::openai::components::OpenAiErrorResponse),
Status500(crate::wire::openai::components::OpenAiErrorResponse),
Status502(crate::wire::openai::components::OpenAiErrorResponse),
Status503(crate::wire::openai::components::OpenAiErrorResponse),
}
#[derive(Debug, Clone, PartialEq)]
pub struct Response {
pub headers: ::http::HeaderMap,
pub body: ResponseBody,
}
impl ::toac::ParseResponse for Response {
type Error = ::toac::DecodeError;
fn parse_response<__B>(
response: ::http::Response<__B>,
) -> impl ::std::future::Future<
Output = ::std::result::Result<Self, Self::Error>,
> + ::std::marker::Send
where
__B: ::http_body::Body<Data = ::bytes::Bytes>
+ ::std::marker::Send
+ ::std::marker::Sync
+ 'static,
__B::Error: ::std::convert::Into<::toac::BoxError>,
{
async move {
let (__parts, __body) = response.into_parts();
let __status = __parts.status;
let __headers = __parts.headers;
match __status.as_u16() {
200u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value = ::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(::std::convert::Into::into(e))
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status200(__value),
});
}
400u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value = ::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(::std::convert::Into::into(e))
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status400(__value),
});
}
401u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value = ::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(::std::convert::Into::into(e))
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status401(__value),
});
}
403u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value = ::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(::std::convert::Into::into(e))
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status403(__value),
});
}
404u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value = ::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(::std::convert::Into::into(e))
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status404(__value),
});
}
413u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value = ::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(::std::convert::Into::into(e))
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status413(__value),
});
}
429u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value = ::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(::std::convert::Into::into(e))
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status429(__value),
});
}
500u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value = ::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(::std::convert::Into::into(e))
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status500(__value),
});
}
502u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value = ::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(::std::convert::Into::into(e))
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status502(__value),
});
}
503u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value = ::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(::std::convert::Into::into(e))
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status503(__value),
});
}
_ => {}
}
::std::mem::drop(__body);
return ::std::result::Result::Err(::toac::DecodeError::UnexpectedStatus(
__status,
));
}
}
}
impl ::toac::Operation for Request {
type Response = Response;
}
}
}
pub mod chat {
pub mod completions {
pub mod post {
#[derive(Debug, Clone, PartialEq)]
pub struct Request {
pub body: crate::wire::openai::components::CreateChatCompletionRequest,
}
impl Request {
pub const METHOD: ::http::Method = ::http::Method::POST;
pub const PATH_TEMPLATE: &'static str = "/chat/completions";
pub const SECURITY: &'static [&'static [&'static str]] = &[&["ApiKeyAuth"]];
pub fn with_accept(
self,
accept: ::http::HeaderValue,
) -> ::toac::WithAccept<Self> {
::toac::WithAccept::new(self, accept)
}
}
impl ::toac::MakeRequest for Request {
type Error = ::serde_json::Error;
fn make_request(
self,
) -> impl ::std::future::Future<
Output = ::std::result::Result<::toac::Request, Self::Error>,
> + Send {
async move {
let mut __path = ::std::string::String::new();
__path.push_str("/chat/completions");
let mut __builder = ::http::Request::builder()
.method(::http::Method::POST)
.uri(__path);
__builder = __builder.header(
::http::header::ACCEPT,
::http::HeaderValue::from_static(
"application/json, text/event-stream",
),
);
let mut __request = __builder
.body(::toac::body::Body::empty())
.expect("valid generated HTTP request");
__request
.extensions_mut()
.insert(::toac::OperationSecurity(&[&["ApiKeyAuth"]]));
{
let __payload = &self.body;
::toac::body::codec::encode_body(
&<::toac::body::codec::json::JsonEncoder as ::std::default::Default>::default(),
__payload,
__request,
)
}
}
}
}
pub enum ResponseBody {
Status200Json(crate::wire::openai::components::CreateChatCompletionResponse),
Status200Sse(::toac::body::codec::sse::SseEventStream),
Status400(crate::wire::openai::components::OpenAiErrorResponse),
Status401(crate::wire::openai::components::OpenAiErrorResponse),
Status403(crate::wire::openai::components::OpenAiErrorResponse),
Status404(crate::wire::openai::components::OpenAiErrorResponse),
Status413(crate::wire::openai::components::OpenAiErrorResponse),
Status429(crate::wire::openai::components::OpenAiErrorResponse),
Status500(crate::wire::openai::components::OpenAiErrorResponse),
Status502(crate::wire::openai::components::OpenAiErrorResponse),
Status503(crate::wire::openai::components::OpenAiErrorResponse),
}
pub struct Response {
pub headers: ::http::HeaderMap,
pub body: ResponseBody,
}
impl ::toac::ParseResponse for Response {
type Error = ::toac::DecodeError;
fn parse_response<__B>(
response: ::http::Response<__B>,
) -> impl ::std::future::Future<
Output = ::std::result::Result<Self, Self::Error>,
> + ::std::marker::Send
where
__B: ::http_body::Body<Data = ::bytes::Bytes>
+ ::std::marker::Send
+ ::std::marker::Sync
+ 'static,
__B::Error: ::std::convert::Into<::toac::BoxError>,
{
async move {
let (__parts, __body) = response.into_parts();
let __status = __parts.status;
let __headers = __parts.headers;
let __content_type = __headers
.get(::http::header::CONTENT_TYPE)
.and_then(|v| v.to_str().ok())
.map(|s| {
s.split(';').next().unwrap_or(s).trim().to_ascii_lowercase()
});
match __status.as_u16() {
200u16 => match __content_type.as_deref() {
::std::option::Option::Some(__ct)
if __ct == "application/json" =>
{
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value =
::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(
::std::convert::Into::into(e),
)
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status200Json(__value),
});
}
::std::option::Option::Some(__ct)
if __ct == "text/event-stream" =>
{
let __decoder = <::toac::body::codec::sse::SseDecoder as ::std::default::Default>::default();
let __value =
::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(
::std::convert::Into::into(e),
)
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status200Sse(__value),
});
}
_ => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value =
::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(
::std::convert::Into::into(e),
)
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status200Json(__value),
});
}
},
400u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value =
::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(
::std::convert::Into::into(e),
)
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status400(__value),
});
}
401u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value =
::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(
::std::convert::Into::into(e),
)
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status401(__value),
});
}
403u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value =
::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(
::std::convert::Into::into(e),
)
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status403(__value),
});
}
404u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value =
::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(
::std::convert::Into::into(e),
)
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status404(__value),
});
}
413u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value =
::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(
::std::convert::Into::into(e),
)
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status413(__value),
});
}
429u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value =
::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(
::std::convert::Into::into(e),
)
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status429(__value),
});
}
500u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value =
::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(
::std::convert::Into::into(e),
)
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status500(__value),
});
}
502u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value =
::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(
::std::convert::Into::into(e),
)
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status502(__value),
});
}
503u16 => {
let __decoder = <::toac::body::codec::json::JsonDecoder as ::std::default::Default>::default();
let __value =
::toac::body::codec::decode_body(&__decoder, __body)
.await
.map_err(|e| {
::toac::DecodeError::Codec(
::std::convert::Into::into(e),
)
})?;
return ::std::result::Result::Ok(Self {
headers: __headers,
body: ResponseBody::Status503(__value),
});
}
_ => {}
}
::std::mem::drop(__body);
return ::std::result::Result::Err(
::toac::DecodeError::UnexpectedStatus(__status),
);
}
}
}
impl ::toac::Operation for Request {
type Response = Response;
}
}
}
}
}
pub mod servers {
#![allow(deprecated)]
#![allow(unreachable_patterns)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(clippy::all, clippy::pedantic)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct ServerOption0;
impl ::toac::Server for ServerOption0 {
fn base_url(&self) -> ::std::borrow::Cow<'_, str> {
::std::borrow::Cow::Borrowed("https://api.openai.com/v1")
}
}
pub type ApiServer = ServerOption0;
}
pub mod security {
#![allow(deprecated)]
#![allow(unreachable_patterns)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(clippy::all, clippy::pedantic)]
#[derive(Debug, Clone)]
pub struct AdminApiKeyAuthCredential {
pub token: ::std::string::String,
}
impl AdminApiKeyAuthCredential {
pub fn new<T: ::std::convert::Into<::std::string::String>>(token: T) -> Self {
Self {
token: token.into(),
}
}
fn as_runtime(&self) -> ::toac::security::BearerCredential {
::toac::security::BearerCredential {
token: self.token.clone(),
}
}
}
impl ::toac::SecurityCredential for AdminApiKeyAuthCredential {
fn apply(
&self,
req: ::toac::Request,
) -> impl ::std::future::Future<
Output = ::std::result::Result<::toac::Request, ::toac::BoxError>,
> + ::std::marker::Send {
let __cred = self.as_runtime();
async move { ::toac::SecurityCredential::apply(&__cred, req).await }
}
}
#[derive(Debug, Clone)]
pub struct ApiKeyAuthCredential {
pub token: ::std::string::String,
}
impl ApiKeyAuthCredential {
pub fn new<T: ::std::convert::Into<::std::string::String>>(token: T) -> Self {
Self {
token: token.into(),
}
}
fn as_runtime(&self) -> ::toac::security::BearerCredential {
::toac::security::BearerCredential {
token: self.token.clone(),
}
}
}
impl ::toac::SecurityCredential for ApiKeyAuthCredential {
fn apply(
&self,
req: ::toac::Request,
) -> impl ::std::future::Future<
Output = ::std::result::Result<::toac::Request, ::toac::BoxError>,
> + ::std::marker::Send {
let __cred = self.as_runtime();
async move { ::toac::SecurityCredential::apply(&__cred, req).await }
}
}
#[derive(Debug, Clone, Default)]
pub struct AuthConfig {
pub admin_api_key_auth: ::std::option::Option<AdminApiKeyAuthCredential>,
pub api_key_auth: ::std::option::Option<ApiKeyAuthCredential>,
}
impl AuthConfig {
pub fn builder() -> AuthConfigBuilder {
<AuthConfigBuilder as ::std::default::Default>::default()
}
}
#[derive(Debug, Clone, Default)]
pub struct AuthConfigBuilder {
admin_api_key_auth: ::std::option::Option<AdminApiKeyAuthCredential>,
api_key_auth: ::std::option::Option<ApiKeyAuthCredential>,
}
impl AuthConfigBuilder {
pub fn admin_api_key_auth<T>(mut self, token: T) -> Self
where
T: ::std::convert::Into<::std::string::String>,
{
self.admin_api_key_auth =
::std::option::Option::Some(AdminApiKeyAuthCredential::new(token));
self
}
pub fn api_key_auth<T>(mut self, token: T) -> Self
where
T: ::std::convert::Into<::std::string::String>,
{
self.api_key_auth = ::std::option::Option::Some(ApiKeyAuthCredential::new(token));
self
}
pub fn build(self) -> AuthConfig {
let Self {
admin_api_key_auth,
api_key_auth,
} = self;
AuthConfig {
admin_api_key_auth,
api_key_auth,
}
}
}
impl ::toac::AuthSelector for AuthConfig {
fn apply_for(
&self,
req: ::toac::Request,
requirements: &'static [&'static [&'static str]],
) -> ::toac::security::AuthFuture<'_> {
::std::boxed::Box::pin(async move {
if requirements.is_empty() {
return ::std::result::Result::Ok(req);
}
let mut __chosen: ::std::option::Option<&'static [&'static str]> =
::std::option::Option::None;
for __alt in requirements {
let mut __can_satisfy = true;
let mut __matched_any = false;
for __scheme in __alt.iter().copied() {
if __scheme == "AdminApiKeyAuth" {
let ::std::option::Option::Some(_) = &self.admin_api_key_auth else {
__can_satisfy = false;
break;
};
__matched_any = true;
continue;
}
if __scheme == "ApiKeyAuth" {
let ::std::option::Option::Some(_) = &self.api_key_auth else {
__can_satisfy = false;
break;
};
__matched_any = true;
continue;
}
let _ = __matched_any;
__can_satisfy = false;
break;
}
if __can_satisfy && __matched_any {
__chosen = ::std::option::Option::Some(__alt);
break;
}
}
let ::std::option::Option::Some(__alt) = __chosen else {
return ::std::result::Result::Err(::std::convert::Into::into(::std::format!(
"no configured credentials satisfy {:?}",
requirements,
)));
};
let mut __req = req;
for __scheme in __alt.iter().copied() {
if __scheme == "AdminApiKeyAuth" {
let ::std::option::Option::Some(__cred) = &self.admin_api_key_auth else {
continue;
};
__req = ::toac::SecurityCredential::apply(__cred, __req).await?;
continue;
}
if __scheme == "ApiKeyAuth" {
let ::std::option::Option::Some(__cred) = &self.api_key_auth else {
continue;
};
__req = ::toac::SecurityCredential::apply(__cred, __req).await?;
continue;
}
}
::std::result::Result::Ok(__req)
})
}
}
}