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

/// BetaLocalShellToolCall : A tool call to run a command on the local shell.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct BetaLocalShellToolCall {
    #[serde(
        rename = "agent",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub agent: Option<Option<Box<models::BetaAgentTag>>>,
    /// The type of the local shell call. Always `local_shell_call`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// The unique ID of the local shell call.
    #[serde(rename = "id")]
    pub id: String,
    /// The unique ID of the local shell tool call generated by the model.
    #[serde(rename = "call_id")]
    pub call_id: String,
    #[serde(rename = "action")]
    pub action: Box<models::BetaLocalShellExecAction>,
    /// The status of the local shell call.
    #[serde(rename = "status")]
    pub status: Status,
}

impl BetaLocalShellToolCall {
    /// A tool call to run a command on the local shell.
    pub fn new(
        r#type: Type,
        id: String,
        call_id: String,
        action: models::BetaLocalShellExecAction,
        status: Status,
    ) -> BetaLocalShellToolCall {
        BetaLocalShellToolCall {
            agent: None,
            r#type,
            id,
            call_id,
            action: Box::new(action),
            status,
        }
    }
}
/// The type of the local shell call. Always `local_shell_call`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "local_shell_call")]
    LocalShellCall,
}

impl Default for Type {
    fn default() -> Type {
        Self::LocalShellCall
    }
}
/// The status of the local shell call.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "in_progress")]
    InProgress,
    #[serde(rename = "completed")]
    Completed,
    #[serde(rename = "incomplete")]
    Incomplete,
}

impl Default for Status {
    fn default() -> Status {
        Self::InProgress
    }
}

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