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

/// FunctionShellCallOutputContent : The content of a shell tool call output that was emitted.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct FunctionShellCallOutputContent {
    /// The standard output that was captured.
    #[serde(rename = "stdout")]
    pub stdout: String,
    /// The standard error output that was captured.
    #[serde(rename = "stderr")]
    pub stderr: String,
    #[serde(rename = "outcome")]
    pub outcome: Box<models::ShellCallOutcome>,
    /// The identifier of the actor that created the item.
    #[serde(rename = "created_by", skip_serializing_if = "Option::is_none")]
    pub created_by: Option<String>,
}

impl FunctionShellCallOutputContent {
    /// The content of a shell tool call output that was emitted.
    pub fn new(
        stdout: String,
        stderr: String,
        outcome: models::ShellCallOutcome,
    ) -> FunctionShellCallOutputContent {
        FunctionShellCallOutputContent {
            stdout,
            stderr,
            outcome: Box::new(outcome),
            created_by: None,
        }
    }
}

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