use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct FunctionShellCallOutputItemParam {
#[serde(
rename = "id",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub id: Option<Option<String>>,
#[serde(rename = "call_id")]
pub call_id: String,
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "output")]
pub output: Vec<models::FunctionShellCallOutputContentParam>,
#[serde(
rename = "status",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub status: Option<Option<models::FunctionShellCallItemStatus>>,
#[serde(
rename = "max_output_length",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub max_output_length: Option<Option<i32>>,
}
impl FunctionShellCallOutputItemParam {
pub fn new(
call_id: String,
r#type: Type,
output: Vec<models::FunctionShellCallOutputContentParam>,
) -> FunctionShellCallOutputItemParam {
FunctionShellCallOutputItemParam {
id: None,
call_id,
r#type,
output,
status: None,
max_output_length: None,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "shell_call_output")]
ShellCallOutput,
}
impl Default for Type {
fn default() -> Type {
Self::ShellCallOutput
}
}
impl std::fmt::Display for FunctionShellCallOutputItemParam {
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),
}
}
}