ResponseReader<P extends StreamPart> class
abstract
Reads one streamed LLM response, chunk by chunk.
Obtained from Parser.openStream or Parser.openContinuingStream. A
stream holds the text buffers of one response and the RendererState its
messages are applied to. Each message it emits, whether feed and close
return it or a thrown error carries it in
A2uiErrorPartialResults.partialResults, has been applied to the state,
in the order emitted, and no other message has, so the state mirrors what
a renderer that received the emitted parts holds.
What happens once a block is rejected depends on how the stream was
opened. A ResponseStream, from openStream, ends: feed or close
throws. A ContinuingResponseStream, from openContinuingStream, returns
an ErrorPart in place of the block instead, drops what the block had not
emitted yet, and goes on with the text and blocks after it.
P is the type of the parts the stream returns.
Constructors
- ResponseReader()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isInBlock → bool
-
Whether the response read so far ends inside a block: after an opening
tag, and before its closing tag.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → RendererState
-
The state the stream's messages are applied to.
no setter
Methods
-
close(
) → List< P> - Ends the response and returns the parts still held back.
-
feed(
String chunk) → List< P> -
Reads the next
chunkand returns the parts that became ready. -
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