openai-client-base 0.14.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 AdditionalTools {
    /// 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::MessageRole,
    /// The additional tool definitions made available at this item.
    #[serde(rename = "tools")]
    pub tools: Vec<models::Tool>,
}

impl AdditionalTools {
    pub fn new(
        r#type: Type,
        id: String,
        role: models::MessageRole,
        tools: Vec<models::Tool>,
    ) -> AdditionalTools {
        AdditionalTools {
            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 AdditionalTools {
    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),
        }
    }
}