pub struct ToolResult {
pub text: String,
pub data: Value,
pub is_error: bool,
pub images: Vec<ToolImage>,
}Expand description
A tool result.
Fields§
§text: String§data: Value§is_error: bool§images: Vec<ToolImage>Images shown to the model (at most 4; png, jpeg, webp or gif; 5 MiB
each). Dropped with a note in text when the host does not support them.
Implementations§
Source§impl ToolResult
impl ToolResult
pub fn text(text: impl Into<String>) -> Self
pub fn error(text: impl Into<String>) -> Self
Sourcepub fn with_image_base64(
self,
media_type: impl Into<String>,
data_base64: impl Into<String>,
) -> Self
pub fn with_image_base64( self, media_type: impl Into<String>, data_base64: impl Into<String>, ) -> Self
Attach an inline image (media_type such as image/png, data in base64).
Sourcepub fn with_image_url(self, url: impl Into<String>) -> Self
pub fn with_image_url(self, url: impl Into<String>) -> Self
Attach a remote https:// image.
pub fn with_data(self, data: impl Serialize) -> Self
Trait Implementations§
Source§impl Clone for ToolResult
impl Clone for ToolResult
Source§impl Debug for ToolResult
impl Debug for ToolResult
Source§impl Default for ToolResult
impl Default for ToolResult
Source§impl PartialEq for ToolResult
impl PartialEq for ToolResult
Source§impl Serialize for ToolResult
impl Serialize for ToolResult
impl StructuralPartialEq for ToolResult
Auto Trait Implementations§
impl Forget for ToolResult
impl Freeze for ToolResult
impl Move for ToolResult
impl RefUnwindSafe for ToolResult
impl Send for ToolResult
impl Sync for ToolResult
impl Unpin for ToolResult
impl UnsafeUnpin for ToolResult
impl UnwindSafe for ToolResult
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