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

/// CreateAgentParams : Parameters for creating a reusable agent.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct CreateAgentParams {
    /// Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map.
    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
    pub metadata: Option<std::collections::HashMap<String, String>>,
    /// A human-readable name for the agent. Omission or null leaves the agent unnamed.
    #[serde(
        rename = "name",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub name: Option<Option<String>>,
    /// The model to use for the agent. The requested model name is preserved.
    #[serde(rename = "model")]
    pub model: String,
    #[serde(
        rename = "reasoning",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub reasoning: Option<Option<models::ReasoningParam>>,
    #[serde(
        rename = "text",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub text: Option<Option<models::TextParam>>,
    #[serde(
        rename = "service_tier",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub service_tier: Option<Option<models::ServiceTierParam>>,
    /// Additional instructions appended to the agent's default base instructions. Omit or set to null to add no custom instructions.
    #[serde(
        rename = "instructions",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub instructions: Option<Option<String>>,
    /// Tools available to the agent. Defaults to an empty list. The tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON.
    #[serde(
        rename = "tools",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub tools: Option<Option<Vec<models::PersistedAgentToolConfigParam>>>,
    #[serde(
        rename = "multi_agent",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub multi_agent: Option<Option<models::MultiAgentConfigCurrentParam>>,
}

impl CreateAgentParams {
    /// Parameters for creating a reusable agent.
    pub fn new(model: String) -> CreateAgentParams {
        CreateAgentParams {
            metadata: None,
            name: None,
            model,
            reasoning: None,
            text: None,
            service_tier: None,
            instructions: None,
            tools: None,
            multi_agent: None,
        }
    }
}

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