An inference format: how the model is told to write A2UI, and how its output is read back.
A format module builds a format value from the active catalogs
(new/2), renders the system prompt snippet (prompt/1) and
creates parsers (parser/1). A format spec names a format module
and the options it is created with, {module, options} (or just the
module); create/3 turns a spec into a format for a set of catalogs,
the way an agent does once per request after negotiating catalogs.
A2UIAgent.DirectJson and A2UIAgent.Express are the built-in
formats.
A format that implements the optional callbacks catalogs/1,
base_rules/1, catalog_instructions/2 and examples/2 (the
pieces its prompt is made of) can also be packaged as skills
(A2UIAgent.SkillGenerator).
Summary
Callbacks
The catalog-independent rules of the prompt.
The prompt's part for one catalog (by id), or for all of them (nil).
The format's active catalogs, in order.
The prompt's examples for one catalog (by id), or for all of them (nil).
Creates the format for catalogs (default catalog first). Options
include :examples, a list of example turns (each a list of
messages).
A fresh parser for the format's catalogs.
The system prompt snippet.
Functions
Creates the format a spec names for catalogs, passing examples.
Types
Callbacks
The catalog-independent rules of the prompt.
The prompt's part for one catalog (by id), or for all of them (nil).
@callback catalogs(struct()) :: [A2UICore.Catalog.t()]
The format's active catalogs, in order.
@callback examples(struct(), String.t() | nil) :: {:ok, String.t()} | {:error, A2UICore.Error.t()}
The prompt's examples for one catalog (by id), or for all of them (nil).
@callback new([A2UICore.Catalog.t()], keyword()) :: {:ok, struct()} | {:error, A2UICore.Error.t()}
Creates the format for catalogs (default catalog first). Options
include :examples, a list of example turns (each a list of
messages).
A fresh parser for the format's catalogs.
@callback prompt(struct()) :: {:ok, String.t()} | {:error, A2UICore.Error.t()}
The system prompt snippet.
Functions
@spec create(spec(), [A2UICore.Catalog.t()], [[map()]] | nil) :: {:ok, struct()} | {:error, A2UICore.Error.t()}
Creates the format a spec names for catalogs, passing examples.