QwenStreamDecoder class

Turns the Stream<String> from the runtime into ChatResponseUpdates, separating three kinds of content:

  • Thinking — a leading <think>…</think> block (Qwen3), surfaced as TextReasoningContent with the markers stripped.
  • Prose — ordinary answer text, emitted as TextContent.
  • Tool calls — the first <tool_call> flips the decoder into buffering mode; on stream end the tail is parsed into FunctionCallContent via QwenChatTemplate.parse.

Text and tool calls are emitted in separate updates: a FunctionInvokingChatClient suppresses any update carrying a function call, so combining them would drop the prose.

Constructors

QwenStreamDecoder([QwenChatTemplate template = const QwenChatTemplate()])
Creates a QwenStreamDecoder.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
template QwenChatTemplate
The template whose parse recovers tool calls from the buffered tail.
final

Methods

decode(Stream<String> tokens) Stream<ChatResponseUpdate>
Splits tokens into reasoning, prose, and tool-call updates.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited