pub struct ToolCall {
pub id: ToolCallId,
pub provider: Option<ProviderCallId>,
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: ToolCallIdRig’s correlation handle. Always present; minted when the provider issued none.
provider: Option<ProviderCallId>What the provider issued, if anything — the only identifiers that
may go back on the wire as that provider’s handles. None means
the provider issued no id (id-less wires such as Gemini REST or
older Ollama daemons).
function: ToolFunctionFunction name and JSON arguments requested by the model.
signature: Option<String>Optional cryptographic signature for the tool call.
This field is used by some providers (e.g., Google) to provide a signature that can verify the authenticity and integrity of the tool call. When present, it allows verification that the tool call was actually generated by the model and has not been tampered with.
This is an optional, provider-specific feature and will be None for providers
that don’t support tool call signatures.
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: ToolCallId, function: ToolFunction) -> Self
pub fn new(id: ToolCallId, function: ToolFunction) -> Self
A call with an explicit correlation handle and no provider-issued id.
Sourcepub fn from_wire(wire_id: impl Into<String>, function: ToolFunction) -> Self
pub fn from_wire(wire_id: impl Into<String>, function: ToolFunction) -> Self
The single-identifier provider boundary: adopt the wire’s id when it issued one, mint when it did not (empty or absent ids mint).
Sourcepub fn from_dual_wire(
item_id: impl Into<String>,
call_id: impl Into<String>,
function: ToolFunction,
) -> Self
pub fn from_dual_wire( item_id: impl Into<String>, call_id: impl Into<String>, function: ToolFunction, ) -> Self
The dual-identifier provider boundary (OpenAI Responses): item_id
is the output-item handle (fc_…), call_id the correlator
(call_…). The correlator drives rig’s id; empty ids mint.
Sourcepub fn with_provider(self, provider: ProviderCallId) -> Self
pub fn with_provider(self, provider: ProviderCallId) -> Self
Attach provider-issued identifiers.
Sourcepub fn wire_call_id(&self) -> &str
pub fn wire_call_id(&self) -> &str
The identifier for a wire whose call-id slot is required: the
provider-issued call_id when the provider issued one, else rig’s
minted handle — always non-empty.
Wires whose id slot is optional (Gemini REST, gRPC) must read
ToolCall::provider directly instead: minted handles never travel
upstream there.
pub fn with_signature(self, signature: Option<String>) -> Self
pub fn with_additional_params(self, additional_params: Option<Value>) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ToolCall
impl<'de> Deserialize<'de> for ToolCall
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>,
Source§impl From<RawStreamingToolCall> for ToolCall
impl From<RawStreamingToolCall> for ToolCall
Source§fn from(tool_call: RawStreamingToolCall) -> Self
fn from(tool_call: RawStreamingToolCall) -> Self
Source§impl From<ToolCall> for FunctionCall
impl From<ToolCall> for FunctionCall
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> 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> ⓘ
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> ⓘ
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