pub enum StreamedTurnEvent {
EmitIngested,
EmitToolCallDelta {
internal_call_id: String,
content: ToolCallDeltaContent,
},
InvalidToolCall(Box<StreamedInvalidToolCall>),
Completed {
usage: Usage,
emit_final: bool,
finish_reason: Option<FinishReason>,
},
}Expand description
What a driver must do with one ingested stream item.
Deliberately exhaustive: a driver must handle every event, so adding a variant is a breaking change by design.
Variants§
EmitIngested
Forward the ingested item to the consumer as-is (text, reasoning, or reasoning deltas, after accumulation).
EmitToolCallDelta
Forward this tool-call delta. Argument deltas buffered while the tool name awaited validation are replayed through this event.
Fields
content: ToolCallDeltaContentThe (possibly repaired) name or argument delta.
InvalidToolCall(Box<StreamedInvalidToolCall>)
The model emitted an unknown or disallowed tool call. Resolve it via
AgentRun::resolve_streamed_invalid_tool_call,
then apply the outcome with
StreamedTurnAssembler::resolve_pending_invalid.
Completed
The provider supplied its typed final payload. Record its usage (see
AgentRun::record_streamed_completion_call);
this does not establish that the provider stream reached EOF. When
emit_final is set, the turn streamed text and the driver should buffer
the final item until EOF finalizes the turn.
Fields
usage: UsageProvider-reported usage for this call. Zero-valued usage means the provider reported no usage metrics.
emit_final: boolWhether the ingested final item should be forwarded to the consumer (set when the turn streamed text).
finish_reason: Option<FinishReason>Why the provider stopped generating, when it reported a reason.
Previously dropped here: the assembler read usage and saw_text
off the terminal record and discarded the rest, so a turn truncated
at the output-token limit reached the driver indistinguishable from
one that simply stopped (rig#2322).
Trait Implementations§
Source§impl Clone for StreamedTurnEvent
impl Clone for StreamedTurnEvent
Source§fn clone(&self) -> StreamedTurnEvent
fn clone(&self) -> StreamedTurnEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more