pub struct ToolResponse {
pub tool_call_id: String,
pub tool_name: String,
pub parts: Vec<Part>,
pub parts_metadata: Option<PartsMetadata>,
}Fields§
§tool_call_id: String§tool_name: String§parts: Vec<Part>Content as parts - automatically converts large content to Part::Artifact
parts_metadata: Option<PartsMetadata>Metadata for parts (e.g., which parts to save)
Implementations§
Source§impl ToolResponse
impl ToolResponse
Sourcepub fn direct(tool_call_id: String, tool_name: String, result: Value) -> Self
pub fn direct(tool_call_id: String, tool_name: String, result: Value) -> Self
Create a ToolResponse with direct content (simple parts, no conversion)
Sourcepub fn from_parts(
tool_call_id: String,
tool_name: String,
parts: Vec<Part>,
) -> Self
pub fn from_parts( tool_call_id: String, tool_name: String, parts: Vec<Part>, ) -> Self
Create a ToolResponse from parts (allows for pre-converted artifacts)
Sourcepub fn filter_for_save(&self) -> Self
pub fn filter_for_save(&self) -> Self
Filter parts based on metadata, returning a new ToolResponse with only saveable parts.
Parts with save: false in the parts_metadata will be filtered out.
If parts_metadata is None, all parts are included.
Sourcepub fn get_artifacts(&self) -> Vec<&FileMetadata>
pub fn get_artifacts(&self) -> Vec<&FileMetadata>
Get all artifacts from this response
Trait Implementations§
Source§impl Clone for ToolResponse
impl Clone for ToolResponse
Source§fn clone(&self) -> ToolResponse
fn clone(&self) -> ToolResponse
Returns a duplicate of the value. Read more
1.0.0 · 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 ToolResponse
impl Debug for ToolResponse
Source§impl<'de> Deserialize<'de> for ToolResponse
impl<'de> Deserialize<'de> for ToolResponse
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 JsonSchema for ToolResponse
impl JsonSchema for ToolResponse
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for ToolResponse
impl PartialEq for ToolResponse
Source§impl Serialize for ToolResponse
impl Serialize for ToolResponse
impl StructuralPartialEq for ToolResponse
Auto Trait Implementations§
impl Freeze for ToolResponse
impl RefUnwindSafe for ToolResponse
impl Send for ToolResponse
impl Sync for ToolResponse
impl Unpin for ToolResponse
impl UnsafeUnpin for ToolResponse
impl UnwindSafe for ToolResponse
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