pub enum ToolResultPart {
Text {
text: String,
},
Tsv {
text: String,
},
Json {
value: Value,
},
Binary {
mime: String,
content: Vec<u8>,
},
}Expand description
One content item inside ToolResult::Parts.
Mirrors the payload-carrying ToolResult variants. Done and Error
have no part equivalent: they describe the call as a whole.
Variants§
Text
UTF-8 plain text output.
Tsv
Tab-separated tabular output.
Json
Structured JSON output.
Binary
Binary or media payload.
Implementations§
Source§impl ToolResultPart
impl ToolResultPart
Sourcepub const fn json_value(value: Value) -> Self
pub const fn json_value(value: Value) -> Self
Creates a JSON part from an already-materialized JSON value.
Sourcepub fn render_for_model(&self) -> Result<String>
pub fn render_for_model(&self) -> Result<String>
Projects the part into a textual representation safe to re-inject into model context.
§Errors
Returns an error if JSON serialization fails.
Sourcepub fn render_for_cli(&self) -> Result<String>
pub fn render_for_cli(&self) -> Result<String>
Sourcepub fn mime(&self) -> Option<Mime>
pub fn mime(&self) -> Option<Mime>
Parses and returns the MIME type when this part carries binary content.
Sourcepub fn into_result(self) -> ToolResult
pub fn into_result(self) -> ToolResult
Lifts the part into its single-payload ToolResult equivalent.
Trait Implementations§
Source§impl Clone for ToolResultPart
impl Clone for ToolResultPart
Source§fn clone(&self) -> ToolResultPart
fn clone(&self) -> ToolResultPart
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 ToolResultPart
impl Debug for ToolResultPart
Source§impl<'de> Deserialize<'de> for ToolResultPart
impl<'de> Deserialize<'de> for ToolResultPart
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 ToolResultPart
Source§impl PartialEq for ToolResultPart
impl PartialEq for ToolResultPart
Source§impl Serialize for ToolResultPart
impl Serialize for ToolResultPart
impl StructuralPartialEq for ToolResultPart
Auto Trait Implementations§
impl Freeze for ToolResultPart
impl RefUnwindSafe for ToolResultPart
impl Send for ToolResultPart
impl Sync for ToolResultPart
impl Unpin for ToolResultPart
impl UnsafeUnpin for ToolResultPart
impl UnwindSafe for ToolResultPart
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