The direct JSON inference format: the model writes A2UI messages as
JSON between <a2ui-json> and </a2ui-json> tags, guided by the
protocol and catalog JSON schemas in its prompt.
{:ok, format} = A2UIAgent.DirectJson.new(catalogs, examples: [example_turn])
{:ok, prompt} = A2UIAgent.DirectJson.prompt(format)
parser = A2UIAgent.DirectJson.parser(format)Options:
:examples— few-shot example turns (lists of messages) rendered into the prompt;:allowed_messages— the message actions the prompt describes (nil, the default, describes all of them);:progressive_keys— string properties the streaming parser may emit before their closing quote (progressive_keys/0lists the usual ones).
See A2UIAgent.DirectJson.Prompt for the prompt and
A2UIAgent.DirectJson.Parser for reading responses.
Summary
Functions
Creates the format. The catalogs must be non-empty, have distinct ids and share a protocol version.
A fresh parser for the format's catalogs.
The string properties commonly healed while streaming.
The system prompt snippet; see A2UIAgent.DirectJson.Prompt.
Types
@type t() :: %A2UIAgent.DirectJson{ allowed_messages: [String.t()] | nil, catalogs: [A2UICore.Catalog.t()], examples: [[map()]] | nil, progressive_keys: [String.t()] }
Functions
@spec new([A2UICore.Catalog.t()], keyword()) :: {:ok, t()} | {:error, A2UICore.Error.t()}
Creates the format. The catalogs must be non-empty, have distinct ids and share a protocol version.
@spec parser(t()) :: A2UIAgent.DirectJson.Parser.t()
A fresh parser for the format's catalogs.
@spec progressive_keys() :: [String.t()]
The string properties commonly healed while streaming.
iex> "text" in A2UIAgent.DirectJson.progressive_keys()
true
@spec prompt(t()) :: {:ok, String.t()} | {:error, A2UICore.Error.t()}
The system prompt snippet; see A2UIAgent.DirectJson.Prompt.