pub struct ToolResponse {
pub tool_call_id: String,
pub tool_name: String,
pub parts: Vec<Part>,
pub parts_metadata: Option<HashMap<usize, PartMetadata>>,
}Fields§
§tool_call_id: String§tool_name: String§parts: Vec<Part>Content as parts - automatically converts large content to Part::Artifact
parts_metadata: Option<HashMap<usize, PartMetadata>>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,
) -> ToolResponse
pub fn direct( tool_call_id: String, tool_name: String, result: Value, ) -> ToolResponse
Create a ToolResponse with direct content (simple parts, no conversion)
Sourcepub fn from_parts(
tool_call_id: String,
tool_name: String,
parts: Vec<Part>,
) -> ToolResponse
pub fn from_parts( tool_call_id: String, tool_name: String, parts: Vec<Part>, ) -> ToolResponse
Create a ToolResponse from parts (allows for pre-converted artifacts)
Sourcepub fn filter_for_save(&self) -> ToolResponse
pub fn filter_for_save(&self) -> ToolResponse
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<ToolResponse, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolResponse, <__D as Deserializer<'de>>::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
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more