pub enum StreamEvent {
Delta(String),
Reasoning(String),
ThinkingBlock {
text: String,
signature: String,
},
ToolCallStart {
id: String,
name: String,
},
ToolCallDelta(String),
ToolCallDone(ToolCall),
Usage(TokenUsage),
Done {
truncated: bool,
},
Error(String),
Warning(String),
}Variants§
Delta(String)
Reasoning(String)
Reasoning-model thinking content (e.g. MiniMax-M2.7, DeepSeek-R1,
o1-series). Some OpenAI-compatible gateways route the full response
here when content is empty — TurnRunner promotes it to the
final text on Done if content ends up empty, which keeps us from
silently returning 0-token “Nailed it” responses for reasoning models.
ThinkingBlock
One complete Anthropic extended-thinking content block. Emitted at
content_block_stop by claude.rs after both thinking_delta and
signature_delta have streamed in for a given block. The runner
accumulates these into MessageContent::AssistantWithToolCalls. thinking_blocks so the next request can echo them back verbatim
(Anthropic 400s otherwise: The content[].thinking in the thinking mode must be passed back to the API). Atomic per-block (vs
streaming text + signature separately) keeps the runner from
having to pair up out-of-order deltas across content blocks.
ToolCallStart
ToolCallDelta(String)
ToolCallDone(ToolCall)
Usage(TokenUsage)
Done
Stream finished. truncated = true means finish_reason was “length”
(model hit max_tokens and was cut off, should continue).
Error(String)
Warning(String)
Non-fatal advisory the provider wants surfaced to the user. Unlike
Error, the stream and the turn continue normally — the warning
is a heads-up (e.g. “your proxy looks like it’s truncating
input”), not a failure. The runner forwards it to
TurnEvent::Warning so the TUI can render it without aborting.
Trait Implementations§
Source§impl Clone for StreamEvent
impl Clone for StreamEvent
Source§fn clone(&self) -> StreamEvent
fn clone(&self) -> StreamEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for StreamEvent
impl RefUnwindSafe for StreamEvent
impl Send for StreamEvent
impl Sync for StreamEvent
impl Unpin for StreamEvent
impl UnsafeUnpin for StreamEvent
impl UnwindSafe for StreamEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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