pub enum StreamedAssistantContent {
Text(Text),
ToolCall {
tool_call: ToolCall,
internal_call_id: String,
},
ToolCallDelta {
internal_call_id: String,
content: ToolCallDeltaContent,
},
Reasoning {
reasoning: Reasoning,
id: String,
},
ReasoningDelta {
id: String,
provider_id: Option<String>,
reasoning: String,
},
Final(StreamFinal),
Unknown(UnknownPayload),
}Expand description
Describes responses from a streamed provider response which is either text, a tool call or a final usage response.
Variants§
Text(Text)
Text delta emitted by the assistant.
ToolCall
Complete tool call emitted by the assistant.
Fields
ToolCallDelta
Partial tool call data emitted by the assistant.
Fields
internal_call_id: StringRig-generated correlator for this call: stable across the call’s
fragments, matches the eventual
StreamedAssistantContent::ToolCall, and unique per run.
Provider-issued ids arrive on the completed ToolCall; no
stream-internal key is ever rendered here.
content: ToolCallDeltaContentReasoning
Complete reasoning block emitted by the assistant.
Supersedes any prior StreamedAssistantContent::ReasoningDeltas
carrying the same correlator id: render it as a replacement for
the accumulated delta text, not an addition. The match key is this
variant’s id, not Reasoning::id.
The aggregated StreamingCompletionResponse::choice already
applies this replacement.
Fields
id: StringRig-generated correlator: matches the id on this part’s prior
StreamedAssistantContent::ReasoningDeltas and is unique per
run. The durable provider handle is reasoning.id; this value
never enters replayable history.
ReasoningDelta
Partial reasoning text emitted by the assistant.
Fields
id: StringRig-generated correlator for the reasoning part this delta extends: stable across the part’s deltas and unique per run. Never a stream-internal key and never a fabricated provider value.
provider_id: Option<String>The provider-issued reasoning item id, when one exists — the
durable handle the aggregated
Reasoning::id will carry
(None on wires that issue no reasoning ids).
Final(StreamFinal)
The provider’s normalized terminal record, if yielded by the stream.
Unknown(UnknownPayload)
A provider-native output item rig does not model, preserved verbatim —
e.g. an OpenAI Responses hosted-tool result (web_search_call,
file_search_call, computer_call, code_interpreter_call). It is
yielded to the consumer for inspection/forwarding but is not added to the
accumulated assistant message or persisted history. Kept last because the
enum is #[serde(untagged)] and the transparent payload wrapper
matches anything, so earlier (typed) variants must be tried first.
Implementations§
Source§impl StreamedAssistantContent
impl StreamedAssistantContent
Sourcepub fn final_response(res: StreamFinal) -> Self
pub fn final_response(res: StreamFinal) -> Self
Create a final response stream item.
Trait Implementations§
Source§impl Clone for StreamedAssistantContent
impl Clone for StreamedAssistantContent
Source§fn clone(&self) -> StreamedAssistantContent
fn clone(&self) -> StreamedAssistantContent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StreamedAssistantContent
impl Debug for StreamedAssistantContent
Source§impl<'de> Deserialize<'de> for StreamedAssistantContent
impl<'de> Deserialize<'de> for StreamedAssistantContent
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 PartialEq for StreamedAssistantContent
impl PartialEq for StreamedAssistantContent
Source§impl Serialize for StreamedAssistantContent
impl Serialize for StreamedAssistantContent
impl StructuralPartialEq for StreamedAssistantContent
Auto Trait Implementations§
impl Freeze for StreamedAssistantContent
impl RefUnwindSafe for StreamedAssistantContent
impl Send for StreamedAssistantContent
impl Sync for StreamedAssistantContent
impl Unpin for StreamedAssistantContent
impl UnsafeUnpin for StreamedAssistantContent
impl UnwindSafe for StreamedAssistantContent
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