openai-client-base 0.16.0

Auto-generated Rust client for the OpenAI API
/*
 * OpenAI API
 *
 * The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
 *
 * The version of the OpenAPI document: 2.3.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// LiveResponsesDelegationSettingsInputParam : Model, prompt, and tool settings for tasks delegated by the Live session to a Responses backend.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct LiveResponsesDelegationSettingsInputParam {
    /// The model used for server-owned Responses delegations.
    #[serde(rename = "model")]
    pub model: String,
    /// Instructions for the delegated Responses model, separate from Live instructions. See [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt).
    #[serde(
        rename = "instructions",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub instructions: Option<Option<String>>,
    /// Maximum number of output tokens for each delegated response.
    #[serde(
        rename = "max_output_tokens",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub max_output_tokens: Option<Option<i32>>,
    #[serde(
        rename = "service_tier",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub service_tier: Option<Option<models::LiveResponsesServiceTier>>,
    #[serde(
        rename = "reasoning",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub reasoning: Option<Option<Box<models::LiveDelegationReasoningInputParam>>>,
    #[serde(
        rename = "text",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub text: Option<Option<Box<models::LiveDelegationTextInputParam>>>,
    /// Tools available to the Responses backend while it handles tasks delegated by the Live model.
    #[serde(rename = "tools", skip_serializing_if = "Option::is_none")]
    pub tools: Option<Vec<models::LiveResponsesDelegationSettingsInputParamToolsInner>>,
    #[serde(rename = "tool_choice", skip_serializing_if = "Option::is_none")]
    pub tool_choice: Option<Box<models::LiveResponsesDelegationSettingsInputParamToolChoice>>,
    /// Whether the delegated Responses model may request multiple tool calls in a single response.
    #[serde(
        rename = "parallel_tool_calls",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub parallel_tool_calls: Option<Option<bool>>,
}

impl LiveResponsesDelegationSettingsInputParam {
    /// Model, prompt, and tool settings for tasks delegated by the Live session to a Responses backend.
    pub fn new(model: String) -> LiveResponsesDelegationSettingsInputParam {
        LiveResponsesDelegationSettingsInputParam {
            model,
            instructions: None,
            max_output_tokens: None,
            service_tier: None,
            reasoning: None,
            text: None,
            tools: None,
            tool_choice: None,
            parallel_tool_calls: None,
        }
    }
}

impl std::fmt::Display for LiveResponsesDelegationSettingsInputParam {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match serde_json::to_string(self) {
            Ok(s) => write!(f, "{}", s),
            Err(_) => Err(std::fmt::Error),
        }
    }
}