ExpressParser class
Reads Express blocks from an LLM response and compiles them into messages of the protocol version the catalogs target.
The compiler checks each component against the schema it reads the component's arguments with. parseResponse checks the messages against a renderer state, as for any format.
Finding, wrapping and unwrapping blocks does not depend on the version.
Constructors
-
ExpressParser(List<
CatalogApi> catalogs, {Set<String> progressiveKeys = defaultExpressProgressiveKeys}) -
The first of
catalogsis the default for a surface that does not name its catalog.
Properties
-
catalogs
→ List<
CatalogApi> -
The active catalogs, in priority order. A call that is given no
RendererState checks the response against a new one holding them.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
progressiveKeys
→ Set<
String> -
Property keys whose open string literals are healed progressively during
streaming.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- supportsStreaming → bool
-
Whether openStream can read a response from this format chunk by
chunk.
no setteroverride
Methods
-
compile(
String formatContent) → List< AgentToRendererMessage> -
Translates the content of one payload block, without its sentinel tags,
into A2UI messages.
override
-
decompile(
List< AgentToRendererMessage> a2uiPayload) → String -
Writes
a2uiPayloadin this format's notation, without sentinel tags.override -
hasFormatContent(
String content, {bool complete = false}) → bool -
Whether
contentcarries an<a2ui>block, closed whencompleteis true.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openContinuingStream(
{bool wrapped = true, RendererState? state}) → ExpressContinuingResponseStream -
Opens an ExpressContinuingResponseStream for one response that reads
past a rejected block. See Parser.openContinuingStream and openStream.
override
-
openStream(
{bool wrapped = true, RendererState? state}) → ExpressResponseStream -
Opens a stream that reads one response chunk by chunk, and ends at the
first rejected block.
override
-
parseResponse(
String content, {bool wrapped = true, RendererState? state}) → List< ResponsePart> -
Parses a complete LLM response into text and A2UI messages, in the order
the LLM emitted them.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
unwrap(
String content) → List< RawResponsePart> -
Splits
contentinto text and Express blocks, in the order the model wrote them.override -
wrap(
List< RawResponsePart> parts) → String -
Writes each part on its own line, with the
<a2ui>and</a2ui>tags on lines of their own. Seeconformance/agent/express/response_parser.yaml.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited