MarkedToolCallDecoder class
Splits a raw token stream into Microsoft.Extensions.AI updates for any family without a reasoning channel.
Prose before openMarker is emitted as TextContent. The first
openMarker flips the decoder into buffering mode: everything from the
marker onward is accumulated and, when the stream ends, handed to parse,
which returns the trailing prose plus the FunctionCallContents. A
FormatException from parse (a truncated or malformed call) surfaces the
raw tail as text rather than erroring the whole turn.
Text and tool calls are emitted in separate updates on purpose:
FunctionInvokingChatClient suppresses any update that carries a function
call, so combining them in one update would drop the prose.
Constructors
- MarkedToolCallDecoder({required String openMarker, required ParsedTurn parse(String generated)})
-
Creates a decoder that buffers on
openMarkerand delegates toparse.const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- openMarker → String
-
The literal marker that begins a tool-call region.
final
- parse → ParsedTurn Function(String generated)
-
Parses a buffered tail (which begins with openMarker) into a turn.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
decode(
Stream< String> tokens) → Stream<ChatResponseUpdate> -
Splits
tokensinto 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