pub struct ToolCallPart {
pub tool_name: String,
pub args: ToolCallArgs,
pub tool_call_id: Option<String>,
pub id: Option<String>,
pub provider_details: Option<Map<String, Value>>,
}Expand description
Tool call part.
Fields§
§tool_name: StringName of the tool being called.
args: ToolCallArgsArguments for the tool call.
tool_call_id: Option<String>Unique identifier for this tool call (provider-assigned).
id: Option<String>Optional unique identifier for this message part.
provider_details: Option<Map<String, Value>>Provider-specific details/metadata.
Implementations§
Source§impl ToolCallPart
impl ToolCallPart
Sourcepub fn new(
tool_name: impl Into<String>,
args: impl Into<ToolCallArgs>,
) -> ToolCallPart
pub fn new( tool_name: impl Into<String>, args: impl Into<ToolCallArgs>, ) -> ToolCallPart
Create a new tool call part.
Sourcepub fn with_tool_call_id(self, id: impl Into<String>) -> ToolCallPart
pub fn with_tool_call_id(self, id: impl Into<String>) -> ToolCallPart
Set the tool call ID (provider-assigned identifier for the tool call).
Sourcepub fn with_id(self, id: impl Into<String>) -> ToolCallPart
👎Deprecated since 0.2.0: Use with_tool_call_id() instead for clarity
pub fn with_id(self, id: impl Into<String>) -> ToolCallPart
Alias for with_tool_call_id - kept for backward compatibility.
Sourcepub fn with_part_id(self, id: impl Into<String>) -> ToolCallPart
pub fn with_part_id(self, id: impl Into<String>) -> ToolCallPart
Set the part ID (unique identifier for this message part).
Sourcepub fn with_provider_details(self, details: Map<String, Value>) -> ToolCallPart
pub fn with_provider_details(self, details: Map<String, Value>) -> ToolCallPart
Set provider-specific details.
Sourcepub fn args_as_dict(&self) -> Value
pub fn args_as_dict(&self) -> Value
Get arguments as a dictionary/object.
Sourcepub fn args_as_json_str(&self) -> Result<String, Error>
pub fn args_as_json_str(&self) -> Result<String, Error>
Sourcepub fn parse_args<T>(&self) -> Result<T, Error>where
T: for<'de> Deserialize<'de>,
pub fn parse_args<T>(&self) -> Result<T, Error>where
T: for<'de> Deserialize<'de>,
Try to deserialize arguments into a typed struct.
Trait Implementations§
Source§impl Clone for ToolCallPart
impl Clone for ToolCallPart
Source§fn clone(&self) -> ToolCallPart
fn clone(&self) -> ToolCallPart
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 ToolCallPart
impl Debug for ToolCallPart
Source§impl<'de> Deserialize<'de> for ToolCallPart
impl<'de> Deserialize<'de> for ToolCallPart
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolCallPart, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolCallPart, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<ToolCallPart> for ModelResponsePart
impl From<ToolCallPart> for ModelResponsePart
Source§fn from(p: ToolCallPart) -> ModelResponsePart
fn from(p: ToolCallPart) -> ModelResponsePart
Converts to this type from the input type.
Source§impl PartialEq for ToolCallPart
impl PartialEq for ToolCallPart
Source§impl Serialize for ToolCallPart
impl Serialize for ToolCallPart
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 ToolCallPart
Auto Trait Implementations§
impl Freeze for ToolCallPart
impl RefUnwindSafe for ToolCallPart
impl Send for ToolCallPart
impl Sync for ToolCallPart
impl Unpin for ToolCallPart
impl UnwindSafe for ToolCallPart
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