pub struct ToolOutput {
pub content: String,
pub images: Vec<Image>,
pub is_error: bool,
pub details: Value,
pub usage: Usage,
pub trust: Option<SourceTrust>,
pub finish: Option<Finish>,
pub suspended: Option<Box<RunState>>,
}Expand description
What a tool hands back to the model, plus structured details for receipts.
Fields§
§content: StringText the model will read.
images: Vec<Image>Images the model will see with the text (a screenshot, a rendered page, an image file the tool read).
is_error: boolThe tool ran but the outcome is a failure the model should react to (non-zero exit, HTTP 4xx, no match). Recorded as a failed receipt.
details: ValueStructured evidence copied into the receipt (exit code, paths, status).
usage: UsageModel usage spent inside the tool (for example a sub-agent). The loop adds it to the run’s usage, so budgets cover delegated work.
trust: Option<SourceTrust>Overrides Tool::source_trust for this result (for example a
fetch tool that knows this particular URL is the owner’s own).
finish: Option<Finish>End the run after this call’s batch (see ToolOutput::finish).
suspended: Option<Box<RunState>>A paused child run: this call has no result yet, and the run pauses
with it (see ToolOutput::suspended).
Implementations§
Source§impl ToolOutput
impl ToolOutput
pub fn text(content: impl Into<String>) -> ToolOutput
pub fn error(content: impl Into<String>) -> ToolOutput
Sourcepub fn suspended(child: RunState) -> ToolOutput
pub fn suspended(child: RunState) -> ToolOutput
The child this call started is interrupted: pause the calling run
too, with child saved in its crate::Pending. The answer reaches
the tool through Tool::resume_child. Only a tool whose
Tool::suspends is true may return this, and child must be
interrupted; anything else is a failed call.
pub fn with_usage(self, usage: Usage) -> ToolOutput
pub fn with_images(self, images: impl IntoIterator<Item = Image>) -> ToolOutput
pub fn with_details(self, details: Value) -> ToolOutput
pub fn with_trust(self, trust: SourceTrust) -> ToolOutput
Sourcepub fn finish(self, finish: Finish) -> ToolOutput
pub fn finish(self, finish: Finish) -> ToolOutput
End the run once the batch this call belongs to completes. Every call in the batch still runs and gets its receipt; if several calls finish, the first in call order wins.
Trait Implementations§
Source§impl Clone for ToolOutput
impl Clone for ToolOutput
Source§fn clone(&self) -> ToolOutput
fn clone(&self) -> ToolOutput
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§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<ToolOutput, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolOutput, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ToolOutput
impl PartialEq for ToolOutput
Source§impl Serialize for ToolOutput
impl Serialize for ToolOutput
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for ToolOutput
Auto Trait Implementations§
impl Forget for ToolOutput
impl Freeze for ToolOutputwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Image>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
*const RunState is !null: Freeze,
PhantomData<RunState>: Freeze,
impl Move for ToolOutput
impl RefUnwindSafe for ToolOutput
impl Send for ToolOutput
impl Sync for ToolOutput
impl Unpin for ToolOutput
impl UnsafeUnpin for ToolOutputwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Image>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
*const RunState is !null: UnsafeUnpin,
PhantomData<RunState>: UnsafeUnpin,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more