A2UIAgent.Generator (A2UIAgent v0.1.1)

Copy Markdown View Source

The agent-level entry point: the catalogs an agent supports, its few-shot examples and its inference format, from which it creates one A2UIAgent.RequestProcessor per request.

{:ok, config} = A2UIAgent.CatalogConfig.from_path("catalogs/basic.json")
generator = A2UIAgent.Generator.new([config], examples: [turn])

# per request, with the capabilities the renderer sent:
{:ok, processor} = A2UIAgent.Generator.create_processor(generator, capabilities)

Catalog negotiation follows A2UIAgent.CatalogResolver.

Summary

Functions

Creates the processor for a renderer's capabilities.

Creates a generator over the registered catalogs.

Types

t()

(since 0.1.0)
@type t() :: %A2UIAgent.Generator{
  accepts_inline_catalogs: boolean(),
  catalogs: [A2UIAgent.CatalogConfig.t()],
  examples: [[map()]] | nil,
  format: A2UIAgent.Format.spec()
}

Functions

create_processor(generator, capabilities, options \\ [])

(since 0.1.0)
@spec create_processor(t(), map() | nil, keyword()) ::
  {:ok, A2UIAgent.RequestProcessor.t()} | {:error, A2UICore.Error.t()}

Creates the processor for a renderer's capabilities.

A processor is negotiated for one renderer, so nil capabilities are a :catalog error here (although A2UIAgent.CatalogResolver.resolve/3 accepts them). Option: :format overrides the generator's format for this processor.

new(catalogs, options \\ [])

(since 0.1.0)
@spec new([A2UIAgent.CatalogConfig.t()], keyword()) :: t()

Creates a generator over the registered catalogs.

Options: :examples; :format (an A2UIAgent.Format.spec/0, A2UIAgent.DirectJson by default); :accepts_inline_catalogs (default false).