pub struct ToolCall {
pub id: CallId,
pub function: ToolFunction,
pub signature: Option<String>,
pub additional_params: Option<Value>,
}Expand description
Describes a tool call with an id and function to call, generally produced by a provider.
Fields§
§id: CallIdThe call’s one identity: the provider’s id, or one rig issued when the provider sent none.
function: ToolFunctionFunction name and JSON arguments requested by the model.
signature: Option<String>Opaque provider signature preserved for replay. Rig does not verify it.
additional_params: Option<Value>Additional provider-specific parameters to be sent to the completion model provider
Implementations§
Source§impl ToolCall
impl ToolCall
Sourcepub fn new(id: CallId, function: ToolFunction) -> ToolCall
pub fn new(id: CallId, function: ToolFunction) -> ToolCall
A call with id.
Sourcepub fn from_wire(wire_id: impl Into<String>, function: ToolFunction) -> ToolCall
pub fn from_wire(wire_id: impl Into<String>, function: ToolFunction) -> ToolCall
A call the provider identified by wire_id; rig issues an id when it
is empty.
Sourcepub fn from_dual_wire(
item_id: impl Into<String>,
call_id: impl Into<String>,
function: ToolFunction,
) -> ToolCall
pub fn from_dual_wire( item_id: impl Into<String>, call_id: impl Into<String>, function: ToolFunction, ) -> ToolCall
The dual-identifier provider boundary (OpenAI Responses): item_id
is the output-item handle (fc_…), call_id the correlator
(call_…). Rig issues an id when call_id is empty.
Sourcepub fn result(&self, content: Vec<ToolResultContent>) -> ToolResult
pub fn result(&self, content: Vec<ToolResultContent>) -> ToolResult
The result answering this call: its id and name, and content.
pub fn with_signature(self, signature: Option<String>) -> ToolCall
pub fn with_additional_params( self, additional_params: Option<Value>, ) -> ToolCall
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ToolCall
impl<'de> Deserialize<'de> for ToolCall
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolCall, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolCall, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<ToolCall> for FunctionCall
impl From<ToolCall> for FunctionCall
Source§fn from(tool_call: ToolCall) -> FunctionCall
fn from(tool_call: ToolCall) -> FunctionCall
Converts to this type from the input type.
Source§impl Serialize for ToolCall
impl Serialize for ToolCall
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 ToolCall
Auto Trait Implementations§
impl Freeze for ToolCall
impl RefUnwindSafe for ToolCall
impl Send for ToolCall
impl Sync for ToolCall
impl Unpin for ToolCall
impl UnsafeUnpin for ToolCall
impl UnwindSafe for ToolCall
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> 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> IntoToolOutput for Twhere
T: Serialize + 'static,
impl<T> IntoToolOutput for Twhere
T: Serialize + 'static,
Source§fn into_tool_output(self) -> Result<ToolOutput, ToolExecutionError>
fn into_tool_output(self) -> Result<ToolOutput, ToolExecutionError>
Convert this value without routing structured data through a string.