pub struct ProviderCallId {
pub call_id: String,
pub item_id: Option<String>,
}Expand description
What the provider issued for a call — the only identifiers that may travel back on that provider’s wire.
Dual-identifier wires need both: OpenAI Responses issues an item id
(fc_…) and a call_id (call_…), and expects the right one in each
position. Single-identifier wires carry their id in call_id and leave
item_id empty.
Fields§
§call_id: StringThe call-correlation identifier the provider expects echoed back.
item_id: Option<String>The output-item id issued alongside call_id on dual-identifier
wires (OpenAI Responses fc_…).
Implementations§
Source§impl ProviderCallId
impl ProviderCallId
Sourcepub fn new(call_id: impl Into<String>) -> Option<ProviderCallId>
pub fn new(call_id: impl Into<String>) -> Option<ProviderCallId>
Adopt a provider-issued call identifier. None for the empty
string: absence is not an id.
Sourcepub fn with_item_id(self, item_id: impl Into<String>) -> ProviderCallId
pub fn with_item_id(self, item_id: impl Into<String>) -> ProviderCallId
Attach the dual-wire output-item id (empty strings are dropped).
Sourcepub fn from_optional_wire(
call_id: Option<String>,
tool_id: Option<String>,
) -> Option<ProviderCallId>
pub fn from_optional_wire( call_id: Option<String>, tool_id: Option<String>, ) -> Option<ProviderCallId>
Derive the provider identity from a streaming part’s optional wire
handles. A dual wire carries (call_id, item id); a single wire’s id
arrives as the tool/part id alone and becomes the call_id; with
neither, the identity is absent. The empty-string filtering is
load-bearing: ProviderCallId::new returns None on empty, so an
empty call_id must fall through to the single-id arm rather than
erase a real tool id.
Both streaming surfaces (the parts accumulator and the raw
ToolCall lift) derive through here so they cannot disagree.
ToolCall::from_dual_wire is deliberately different — a dual wire
that omits its call_id has no single-id fallback — and stays
separate.
Trait Implementations§
Source§impl Clone for ProviderCallId
impl Clone for ProviderCallId
Source§fn clone(&self) -> ProviderCallId
fn clone(&self) -> ProviderCallId
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more