pub struct FunctionCallContent {
pub call_id: String,
pub name: String,
pub arguments: Option<FunctionArguments>,
pub protected_data: Option<String>,
pub id: Option<String>,
}Expand description
A request from the model to call a tool/function.
arguments may be a partial JSON string (during streaming) or a completed
JSON object.
Fields§
§call_id: String§name: String§arguments: Option<FunctionArguments>§protected_data: Option<String>Provider-opaque replay token attached to this call, base64.
The counterpart of TextReasoningContent::protected_data. Gemini 3
returns a thoughtSignature on the part carrying the function call —
the usual placement — and requires it echoed when the call is
replayed; a signature on a preceding thought part is the fallback.
Absent for providers that do not use one.
id: Option<String>A framework-generated id for this occurrence of the call, distinct
from Self::call_id.
call_id is the provider’s, and providers reuse it: the same id can
name two different invocations in one conversation. That is fine while
a call is answered immediately, but an approval round trip leaves a
call outstanding across turns, and two approvals pending at once under
one call_id cannot then be told apart — approving one can resolve
the other.
An occurrence id is minted when a call first needs to outlive its turn
(see FunctionInvokingChatClient’s approval path), formatted
af-call-<uuid>. Mirrors upstream’s Content.id (#7383/#7988).
None for a call that never needed one, and for calls restored from
state written before this existed — Self::same_invocation falls
back to structural comparison there.
Implementations§
Source§impl FunctionCallContent
impl FunctionCallContent
pub fn new( call_id: impl Into<String>, name: impl Into<String>, arguments: Option<FunctionArguments>, ) -> FunctionCallContent
Sourcepub fn ensure_occurrence_id(&mut self) -> &str
pub fn ensure_occurrence_id(&mut self) -> &str
Mint an occurrence id for this call if it has none, and return it.
See Self::id. Idempotent: a call that already carries one keeps it,
so re-processing a conversation cannot re-identify a call and orphan an
approval already bound to it.
Sourcepub fn same_invocation(&self, other: &FunctionCallContent) -> bool
pub fn same_invocation(&self, other: &FunctionCallContent) -> bool
Whether other is the same invocation as this call.
Occurrence ids decide it when both sides carry one — that is what they
exist for, and two calls that are structurally identical but separately
issued are genuinely different invocations. When either side has none
(a call that never needed an id, or state written before ids existed),
this falls back to the structural comparison that was the only rule
before: same call_id, name and arguments. Mirrors upstream’s staged
migration, which likewise accepts the legacy binding rather than
dropping approvals stored under it.
protected_data is deliberately not compared: it is a provider replay
token attached to whichever fragment carried it, not part of the call’s
identity.
Sourcepub fn with_protected_data(
self,
protected_data: Option<String>,
) -> FunctionCallContent
pub fn with_protected_data( self, protected_data: Option<String>, ) -> FunctionCallContent
Attach a provider-opaque replay token (see
Self::protected_data).
Trait Implementations§
Source§impl Clone for FunctionCallContent
impl Clone for FunctionCallContent
Source§fn clone(&self) -> FunctionCallContent
fn clone(&self) -> FunctionCallContent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more