pub struct ToolResultMessage {
pub role: ToolResultRole,
pub tool_call_id: String,
pub tool_name: String,
pub content: Vec<ContentBlock>,
pub details: Option<Value>,
pub is_error: bool,
pub timestamp: i64,
}Expand description
Message types for constructing conversations. Tool result message carrying the output of a tool invocation.
Fields§
§role: ToolResultRoleRole discriminator (always ToolResultRole::ToolResult).
tool_call_id: StringMatches the ToolCall::id this result is for.
tool_name: StringName of the tool that was executed.
content: Vec<ContentBlock>Result content blocks.
details: Option<Value>Optional structured details about the result.
is_error: boolWhether this result represents an error.
timestamp: i64Unix-epoch milliseconds when the message was created.
Implementations§
Source§impl ToolResultMessage
impl ToolResultMessage
Sourcepub fn new(
tool_call_id: impl Into<String>,
tool_name: impl Into<String>,
content: Vec<ContentBlock>,
) -> Self
pub fn new( tool_call_id: impl Into<String>, tool_name: impl Into<String>, content: Vec<ContentBlock>, ) -> Self
Create a successful tool result.
Sourcepub fn error(
tool_call_id: impl Into<String>,
tool_name: impl Into<String>,
error: impl Into<String>,
) -> Self
pub fn error( tool_call_id: impl Into<String>, tool_name: impl Into<String>, error: impl Into<String>, ) -> Self
Create an error tool result.
Sourcepub fn text_content(&self) -> Result<String, ProviderError>
pub fn text_content(&self) -> Result<String, ProviderError>
Render all content blocks into a human-readable string.
Trait Implementations§
Source§impl Clone for ToolResultMessage
impl Clone for ToolResultMessage
Source§fn clone(&self) -> ToolResultMessage
fn clone(&self) -> ToolResultMessage
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 ToolResultMessage
impl Debug for ToolResultMessage
Source§impl<'de> Deserialize<'de> for ToolResultMessage
impl<'de> Deserialize<'de> for ToolResultMessage
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
Auto Trait Implementations§
impl Freeze for ToolResultMessage
impl RefUnwindSafe for ToolResultMessage
impl Send for ToolResultMessage
impl Sync for ToolResultMessage
impl Unpin for ToolResultMessage
impl UnsafeUnpin for ToolResultMessage
impl UnwindSafe for ToolResultMessage
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