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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct BetaAdditionalTools {
    #[serde(rename = "agent", skip_serializing_if = "Option::is_none")]
    pub agent: Option<Box<models::BetaAgentTag>>,
    /// The type of the item. Always `additional_tools`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The unique ID of the additional tools item.
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "role")]
    pub role: models::BetaMessageRole,
    /// The additional tool definitions made available at this item.
    #[serde(rename = "tools")]
    pub tools: Vec<models::BetaTool>,
}

impl BetaAdditionalTools {
    pub fn new(
        r#type: Type,
        id: String,
        role: models::BetaMessageRole,
        tools: Vec<models::BetaTool>,
    ) -> BetaAdditionalTools {
        BetaAdditionalTools {
            agent: None,
            r#type,
            id,
            role,
            tools,
        }
    }
}
/// The type of the item. Always `additional_tools`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "additional_tools")]
    AdditionalTools,
}

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

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