pub struct ToolOutput {
pub content: String,
pub is_error: bool,
}Expand description
What a tool returns to the model.
is_error marks content that describes a failure the model may react to,
such as an HTTP error status from a remote API.
Fields§
§content: String§is_error: boolImplementations§
Source§impl ToolOutput
impl ToolOutput
Sourcepub fn text(content: impl Into<String>) -> Self
pub fn text(content: impl Into<String>) -> Self
Builds a successful output holding content.
Returns the output with is_error false.
Sourcepub fn error(content: impl Into<String>) -> Self
pub fn error(content: impl Into<String>) -> Self
Builds an error output holding content.
Returns the output with is_error true.
Sourcepub fn from_result(result: Result<ToolOutput, ToolError>) -> Self
pub fn from_result(result: Result<ToolOutput, ToolError>) -> Self
Folds a tool result into what the model sees.
Ok passes through; Err becomes an error output whose content is
the error’s display text, which never holds secret values.
Trait Implementations§
Source§impl Clone for ToolOutput
impl Clone for ToolOutput
Source§impl Debug for ToolOutput
impl Debug for ToolOutput
impl Eq for ToolOutput
Source§impl PartialEq for ToolOutput
impl PartialEq for ToolOutput
impl StructuralPartialEq for ToolOutput
Auto Trait Implementations§
impl Forget for ToolOutput
impl Freeze for ToolOutput
impl Move for ToolOutput
impl RefUnwindSafe for ToolOutput
impl Send for ToolOutputwhere
RawVecInner: Send,
impl Sync for ToolOutputwhere
RawVecInner: Sync,
impl Unpin for ToolOutput
impl UnsafeUnpin for ToolOutput
impl UnwindSafe for ToolOutputwhere
RawVecInner: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.