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};

/// AutoCodeInterpreterToolParam : Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct AutoCodeInterpreterToolParam {
    /// Always `auto`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// An optional list of uploaded files to make available to your code.
    #[serde(rename = "file_ids", skip_serializing_if = "Option::is_none")]
    pub file_ids: Option<Vec<String>>,
    #[serde(
        rename = "memory_limit",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub memory_limit: Option<Option<models::ContainerMemoryLimit>>,
    #[serde(rename = "network_policy", skip_serializing_if = "Option::is_none")]
    pub network_policy: Option<Box<models::CreateContainerBodyNetworkPolicy>>,
}

impl AutoCodeInterpreterToolParam {
    /// Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.
    pub fn new(r#type: Type) -> AutoCodeInterpreterToolParam {
        AutoCodeInterpreterToolParam {
            r#type,
            file_ids: None,
            memory_limit: None,
            network_policy: None,
        }
    }
}
/// Always `auto`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "auto")]
    Auto,
}

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

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