pub struct BuiltinToolCallPart {
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
A builtin tool call from a model (web search, code execution, etc.).
Builtin tools are provider-native capabilities like web search, code execution, and file search. They are distinct from user-defined function tools and require special handling for UI rendering and history management.
Fields§
§tool_name: StringName of the builtin tool being called (e.g., “web_search”, “code_execution”).
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 BuiltinToolCallPart
impl BuiltinToolCallPart
Sourcepub fn new(
tool_name: impl Into<String>,
args: impl Into<ToolCallArgs>,
) -> BuiltinToolCallPart
pub fn new( tool_name: impl Into<String>, args: impl Into<ToolCallArgs>, ) -> BuiltinToolCallPart
Create a new builtin tool call part.
Sourcepub fn with_tool_call_id(self, id: impl Into<String>) -> BuiltinToolCallPart
pub fn with_tool_call_id(self, id: impl Into<String>) -> BuiltinToolCallPart
Set the tool call ID (provider-assigned identifier for the tool call).
Sourcepub fn with_part_id(self, id: impl Into<String>) -> BuiltinToolCallPart
pub fn with_part_id(self, id: impl Into<String>) -> BuiltinToolCallPart
Set the part ID (unique identifier for this message part).
Sourcepub fn with_provider_details(
self,
details: Map<String, Value>,
) -> BuiltinToolCallPart
pub fn with_provider_details( self, details: Map<String, Value>, ) -> BuiltinToolCallPart
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 BuiltinToolCallPart
impl Clone for BuiltinToolCallPart
Source§fn clone(&self) -> BuiltinToolCallPart
fn clone(&self) -> BuiltinToolCallPart
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more