pub struct ToolReturnPart {
pub tool_call_id: String,
pub name: String,
pub content: Value,
pub is_error: bool,
pub metadata: Metadata,
pub app_value: Option<Value>,
pub user_content: Option<Value>,
pub private_metadata: Metadata,
}Expand description
Tool return content.
Fields§
§tool_call_id: StringRelated call identifier.
name: StringTool name.
content: ValueTool content sent back to the model.
is_error: boolTool result status.
metadata: MetadataTool return metadata for approval, deferral, and runtime orchestration.
app_value: Option<Value>Application-facing return value when it differs from model-visible content.
user_content: Option<Value>User-facing content for UI display and host rendering.
private_metadata: MetadataPrivate host metadata kept separate from provider request mapping.
Implementations§
Source§impl ToolReturnPart
impl ToolReturnPart
Sourcepub fn new(
tool_call_id: impl Into<String>,
name: impl Into<String>,
content: Value,
) -> Self
pub fn new( tool_call_id: impl Into<String>, name: impl Into<String>, content: Value, ) -> Self
Build a tool return part with model-visible content.
Sourcepub const fn with_error(self, is_error: bool) -> Self
pub const fn with_error(self, is_error: bool) -> Self
Mark this tool return as an error.
Sourcepub fn with_metadata(self, metadata: Metadata) -> Self
pub fn with_metadata(self, metadata: Metadata) -> Self
Attach public runtime metadata.
Sourcepub fn with_app_value(self, app_value: Value) -> Self
pub fn with_app_value(self, app_value: Value) -> Self
Attach application-facing return value.
Sourcepub fn with_user_content(self, user_content: Value) -> Self
pub fn with_user_content(self, user_content: Value) -> Self
Attach user-facing content.
Sourcepub fn with_private_metadata(self, private_metadata: Metadata) -> Self
pub fn with_private_metadata(self, private_metadata: Metadata) -> Self
Attach private host metadata.
Trait Implementations§
Source§impl Clone for ToolReturnPart
impl Clone for ToolReturnPart
Source§fn clone(&self) -> ToolReturnPart
fn clone(&self) -> ToolReturnPart
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 ToolReturnPart
impl Debug for ToolReturnPart
Source§impl<'de> Deserialize<'de> for ToolReturnPart
impl<'de> Deserialize<'de> for ToolReturnPart
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
impl Eq for ToolReturnPart
Source§impl PartialEq for ToolReturnPart
impl PartialEq for ToolReturnPart
Source§impl Serialize for ToolReturnPart
impl Serialize for ToolReturnPart
impl StructuralPartialEq for ToolReturnPart
Auto Trait Implementations§
impl Freeze for ToolReturnPart
impl RefUnwindSafe for ToolReturnPart
impl Send for ToolReturnPart
impl Sync for ToolReturnPart
impl Unpin for ToolReturnPart
impl UnsafeUnpin for ToolReturnPart
impl UnwindSafe for ToolReturnPart
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