use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct SessionInputParamAgentSessionInputToolResult {
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "turn_id")]
pub turn_id: String,
#[serde(rename = "call_id")]
pub call_id: String,
#[serde(rename = "success")]
pub success: bool,
#[serde(
rename = "output",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub output: Option<Option<Box<models::FunctionCallOutputParam>>>,
#[serde(
rename = "error",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub error: Option<Option<String>>,
}
impl SessionInputParamAgentSessionInputToolResult {
pub fn new(
r#type: Type,
turn_id: String,
call_id: String,
success: bool,
) -> SessionInputParamAgentSessionInputToolResult {
SessionInputParamAgentSessionInputToolResult {
r#type,
turn_id,
call_id,
success,
output: None,
error: None,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "agent.session.input.tool_result")]
AgentSessionInputToolResult,
}
impl Default for Type {
fn default() -> Type {
Self::AgentSessionInputToolResult
}
}
impl std::fmt::Display for SessionInputParamAgentSessionInputToolResult {
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),
}
}
}