#[non_exhaustive]pub enum ToolResultBlock {
Text {
text: String,
},
Image {
source: Source,
},
}Expand description
One block inside a ToolResultContent::blocks list.
Several blocks can be interleaved inside a single tool reply
(e.g. text + a rendered chart), so a tool that generates an image
alongside an explanation does not have to choose. Error semantics
live on the parent ToolResultContent::is_error, not per-block,
so a failed reply can still carry images.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Text
Plain text segment of the tool reply.
Image
Image segment of the tool reply. Adapters that cannot represent images inside tool results surface a typed error.
Implementations§
Source§impl ToolResultBlock
impl ToolResultBlock
Sourcepub fn text(text: impl Into<String>) -> Self
pub fn text(text: impl Into<String>) -> Self
Build a ToolResultBlock::Text.
Sourcepub fn image(source: Source) -> Self
pub fn image(source: Source) -> Self
Build a ToolResultBlock::Image from the given source.
Trait Implementations§
Source§impl Clone for ToolResultBlock
impl Clone for ToolResultBlock
Source§fn clone(&self) -> ToolResultBlock
fn clone(&self) -> ToolResultBlock
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 ToolResultBlock
impl Debug for ToolResultBlock
Source§impl<'de> Deserialize<'de> for ToolResultBlock
impl<'de> Deserialize<'de> for ToolResultBlock
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
Source§impl PartialEq for ToolResultBlock
impl PartialEq for ToolResultBlock
Source§fn eq(&self, other: &ToolResultBlock) -> bool
fn eq(&self, other: &ToolResultBlock) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ToolResultBlock
impl Serialize for ToolResultBlock
impl StructuralPartialEq for ToolResultBlock
Auto Trait Implementations§
impl Freeze for ToolResultBlock
impl RefUnwindSafe for ToolResultBlock
impl Send for ToolResultBlock
impl Sync for ToolResultBlock
impl Unpin for ToolResultBlock
impl UnsafeUnpin for ToolResultBlock
impl UnwindSafe for ToolResultBlock
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