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>) -> ToolOutput
pub fn text(content: impl Into<String>) -> ToolOutput
Builds a successful output holding content.
Returns the output with is_error false.
Sourcepub fn error(content: impl Into<String>) -> ToolOutput
pub fn error(content: impl Into<String>) -> ToolOutput
Builds an error output holding content.
Returns the output with is_error true.
Sourcepub fn from_result(result: Result<ToolOutput, ToolError>) -> ToolOutput
pub fn from_result(result: Result<ToolOutput, ToolError>) -> ToolOutput
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§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 moreSource§impl Debug for ToolOutput
impl Debug for ToolOutput
impl Eq for ToolOutput
Source§impl IntoToolOutput for ToolOutput
impl IntoToolOutput for ToolOutput
Source§fn into_output(self) -> ToolOutput
fn into_output(self) -> ToolOutput
Consumes the value and returns the model-facing output.
Never panics; a value that cannot be rendered becomes an error output.
The output content is the text the model reads.
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.