pub struct ToolOutput {
pub content: String,
pub is_error: bool,
}Expand description
Output of a tool execution.
Fields§
§content: String§is_error: boolImplementations§
Source§impl ToolOutput
impl ToolOutput
pub fn success(content: impl Into<String>) -> Self
pub fn error(content: impl Into<String>) -> Self
Sourcepub fn truncated(self, max_bytes: usize) -> Self
pub fn truncated(self, max_bytes: usize) -> Self
Truncate content if it exceeds max_bytes, preserving UTF-8 validity.
When truncated, appends a [truncated: N bytes omitted] suffix so the
LLM knows data was cut. Content within the limit is returned unchanged.
A max_bytes of 0 is treated as no-op (returns content unchanged).
Note: the suffix itself is not counted toward max_bytes, so the
result may slightly exceed the limit.
Trait Implementations§
Source§impl Clone for ToolOutput
impl Clone for ToolOutput
Source§fn clone(&self) -> ToolOutput
fn clone(&self) -> ToolOutput
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto 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