openai-client-base 0.12.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};

/// ComputerCallOutputItemParam : The output of a computer tool call.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ComputerCallOutputItemParam {
    /// The ID of the computer tool call output.
    #[serde(
        rename = "id",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub id: Option<Option<String>>,
    /// The ID of the computer tool call that produced the output.
    #[serde(rename = "call_id")]
    pub call_id: String,
    /// The type of the computer tool call output. Always `computer_call_output`.
    #[serde(rename = "type")]
    pub r#type: Type,
    #[serde(rename = "output")]
    pub output: Box<models::ComputerScreenshotImage>,
    /// The safety checks reported by the API that have been acknowledged by the developer.
    #[serde(
        rename = "acknowledged_safety_checks",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub acknowledged_safety_checks: Option<Option<Vec<models::ComputerCallSafetyCheckParam>>>,
    #[serde(
        rename = "status",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub status: Option<Option<models::FunctionCallItemStatus>>,
}

impl ComputerCallOutputItemParam {
    /// The output of a computer tool call.
    pub fn new(
        call_id: String,
        r#type: Type,
        output: models::ComputerScreenshotImage,
    ) -> ComputerCallOutputItemParam {
        ComputerCallOutputItemParam {
            id: None,
            call_id,
            r#type,
            output: Box::new(output),
            acknowledged_safety_checks: None,
            status: None,
        }
    }
}
/// The type of the computer tool call output. Always `computer_call_output`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "computer_call_output")]
    ComputerCallOutput,
}

impl Default for Type {
    fn default() -> Type {
        Self::ComputerCallOutput
    }
}

impl std::fmt::Display for ComputerCallOutputItemParam {
    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),
        }
    }
}