pub struct ToolOutput {
pub tool_call_id: String,
pub tool_name: String,
pub output: Value,
pub is_final: bool,
pub is_error: bool,
pub duration_ms: Option<u128>,
}Expand description
Represents the output from a tool execution
Fields§
§tool_call_id: StringThe tool call ID this output corresponds to
tool_name: StringThe tool name that was executed
output: ValueThe output/result from the tool
is_final: boolWhether this is the final answer
is_error: boolWhether the execution resulted in an error
duration_ms: Option<u128>Execution duration in milliseconds
Implementations§
Source§impl ToolOutput
impl ToolOutput
Sourcepub fn success(tool_call_id: String, tool_name: String, output: Value) -> Self
pub fn success(tool_call_id: String, tool_name: String, output: Value) -> Self
Create a successful tool output
Sourcepub fn error(tool_call_id: String, tool_name: String, error_msg: String) -> Self
pub fn error(tool_call_id: String, tool_name: String, error_msg: String) -> Self
Create an error tool output
Sourcepub fn with_duration(self, duration: Duration) -> Self
pub fn with_duration(self, duration: Duration) -> Self
Set the execution duration
Sourcepub fn to_openai_message(&self) -> Value
pub fn to_openai_message(&self) -> Value
Convert to OpenAI tool message format
Trait Implementations§
Source§impl Clone for ToolOutput
impl Clone for ToolOutput
Source§impl Debug for ToolOutput
impl Debug for ToolOutput
Source§impl<'de> Deserialize<'de> for ToolOutput
impl<'de> Deserialize<'de> for ToolOutput
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ToolOutput
impl RefUnwindSafe for ToolOutput
impl Send for ToolOutput
impl Sync for ToolOutput
impl Unpin for ToolOutput
impl UnsafeUnpin for ToolOutput
impl UnwindSafe for ToolOutput
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more