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

/// LocalShellToolCall : A tool call to run a command on the local shell.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct LocalShellToolCall {
    /// 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::LocalShellExecAction>,
    /// The status of the local shell call.
    #[serde(rename = "status")]
    pub status: Status,
}

impl LocalShellToolCall {
    /// A tool call to run a command on the local shell.
    pub fn new(
        r#type: Type,
        id: String,
        call_id: String,
        action: models::LocalShellExecAction,
        status: Status,
    ) -> LocalShellToolCall {
        LocalShellToolCall {
            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 LocalShellToolCall {
    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),
        }
    }
}