pub enum TokenEventV2 {
Text(String),
Thinking(String),
ToolUse {
tool_call_id: ToolCallId,
name: String,
input: ToolUseInput,
},
Done {
stop_reason: StopReasonV2,
usage: UsageV2,
},
}Expand description
One event in a v2 generation stream — typed-content-block surface per ADR 0015.
v2 separates user-visible text (Text) from reasoning trace
(Thinking) and emits complete tool-call requests (ToolUse) as
their own variant rather than raw tokens. Backends that don’t
distinguish thinking content (any non-Gemma-4 backend) emit only
Text events.
Variants§
Text(String)
Incremental user-visible text.
Thinking(String)
Incremental reasoning trace (Gemma 4 <|think|> content).
ToolUse
Complete tool-call request emitted by the model.
Fields
§
tool_call_id: ToolCallIdIdentifier paired with the consumer’s eventual ToolResult.
§
input: ToolUseInputJSON arguments emitted by the model.
Done
Final event for a successful generation.
Trait Implementations§
Source§impl Clone for TokenEventV2
impl Clone for TokenEventV2
Source§fn clone(&self) -> TokenEventV2
fn clone(&self) -> TokenEventV2
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TokenEventV2
impl Debug for TokenEventV2
Source§impl PartialEq for TokenEventV2
impl PartialEq for TokenEventV2
Source§fn eq(&self, other: &TokenEventV2) -> bool
fn eq(&self, other: &TokenEventV2) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TokenEventV2
Auto Trait Implementations§
impl Freeze for TokenEventV2
impl RefUnwindSafe for TokenEventV2
impl Send for TokenEventV2
impl Sync for TokenEventV2
impl Unpin for TokenEventV2
impl UnsafeUnpin for TokenEventV2
impl UnwindSafe for TokenEventV2
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
Mutably borrows from an owned value. Read more