pub enum ToolResultBody {
Text {
text: String,
},
Json {
value: Value,
},
Content {
blocks: Vec<ToolResultContent>,
},
}Expand description
Tool result payload. The codec converts it for the wire during serialization: some
wires only support strings, so they stringify ToolResultBody::Json.
Variants§
Text
Json
Content
Multimodal tool result: a mix of text and image blocks. Used by read_file for
images and future screenshot tools.
Materialization per provider is handled by the codec, with different shapes:
- Anthropic’s
tool_resultblock natively supports images; just insert each block as-is. - OpenAI’s tool message only accepts text — the codec strips image blocks and attaches them to the following user message, leaving only text (including placeholder hints) in the tool message.
Fields
§
blocks: Vec<ToolResultContent>Trait Implementations§
Source§impl Clone for ToolResultBody
impl Clone for ToolResultBody
Source§fn clone(&self) -> ToolResultBody
fn clone(&self) -> ToolResultBody
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 ToolResultBody
impl Debug for ToolResultBody
Source§impl<'de> Deserialize<'de> for ToolResultBody
impl<'de> Deserialize<'de> for ToolResultBody
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolResultBody, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolResultBody, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ToolResultBody
impl PartialEq for ToolResultBody
Source§fn eq(&self, other: &ToolResultBody) -> bool
fn eq(&self, other: &ToolResultBody) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ToolResultBody
impl Serialize for ToolResultBody
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,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ToolResultBody
Auto Trait Implementations§
impl Freeze for ToolResultBody
impl RefUnwindSafe for ToolResultBody
impl Send for ToolResultBody
impl Sync for ToolResultBody
impl Unpin for ToolResultBody
impl UnsafeUnpin for ToolResultBody
impl UnwindSafe for ToolResultBody
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