pub struct ToolUseBlock {
pub id: String,
pub input: Value,
pub name: String,
pub cache_control: Option<CacheControlEphemeral>,
}Expand description
A block representing a tool use request from the model.
ToolUseBlocks indicate the model wants to use a specific tool with certain inputs.
Fields§
§id: StringA unique identifier for this tool use request.
input: ValueThe input data for the tool, can be any valid JSON.
name: StringThe name of the tool being invoked.
cache_control: Option<CacheControlEphemeral>Create a cache control breakpoint at this content block.
Implementations§
Source§impl ToolUseBlock
impl ToolUseBlock
Sourcepub fn new<S1: Into<String>, S2: Into<String>>(
id: S1,
name: S2,
input: Value,
) -> Self
pub fn new<S1: Into<String>, S2: Into<String>>( id: S1, name: S2, input: Value, ) -> Self
Creates a new ToolUseBlock with the specified id, name, and input.
Sourcepub fn with_cache_control(self, cache_control: CacheControlEphemeral) -> Self
pub fn with_cache_control(self, cache_control: CacheControlEphemeral) -> Self
Add a cache control to this tool use block.
Trait Implementations§
Source§impl Clone for ToolUseBlock
impl Clone for ToolUseBlock
Source§fn clone(&self) -> ToolUseBlock
fn clone(&self) -> ToolUseBlock
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 ToolUseBlock
impl Debug for ToolUseBlock
Source§impl<'de> Deserialize<'de> for ToolUseBlock
impl<'de> Deserialize<'de> for ToolUseBlock
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 From<ToolUseBlock> for ContentBlock
impl From<ToolUseBlock> for ContentBlock
Source§fn from(block: ToolUseBlock) -> Self
fn from(block: ToolUseBlock) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ToolUseBlock
impl PartialEq for ToolUseBlock
Source§impl Serialize for ToolUseBlock
impl Serialize for ToolUseBlock
impl StructuralPartialEq for ToolUseBlock
Auto Trait Implementations§
impl Freeze for ToolUseBlock
impl RefUnwindSafe for ToolUseBlock
impl Send for ToolUseBlock
impl Sync for ToolUseBlock
impl Unpin for ToolUseBlock
impl UnsafeUnpin for ToolUseBlock
impl UnwindSafe for ToolUseBlock
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