A2UIAgent.CatalogConfig (A2UIAgent v0.1.1)

Copy Markdown View Source

A catalog an agent registers, together with the transformers applied to it.

config =
  A2UIAgent.CatalogConfig.new(catalog,
    transformers: [A2UIAgent.CatalogTransformer.component_pruning(["Text", "Button"])]
  )

config.transformed
#=> the pruned catalog, which prompts and validation use

The transformed catalog is computed once, when the config is built.

Summary

Functions

Loads a catalog file with A2UIAgent.CatalogProvider.load_file/2 and registers it. Options: :transformers, :catalog_id, :protocol_version.

Registers catalog. Option: :transformers, applied in order.

Types

t()

(since 0.1.0)
@type t() :: %A2UIAgent.CatalogConfig{
  catalog: A2UICore.Catalog.t(),
  transformed: A2UICore.Catalog.t(),
  transformers: [A2UIAgent.CatalogTransformer.t()]
}

Functions

from_path(path, options \\ [])

(since 0.1.0)
@spec from_path(String.t(), keyword()) :: {:ok, t()} | {:error, A2UICore.Error.t()}

Loads a catalog file with A2UIAgent.CatalogProvider.load_file/2 and registers it. Options: :transformers, :catalog_id, :protocol_version.

new(catalog, options \\ [])

(since 0.1.0)
@spec new(A2UICore.Catalog.t(), keyword()) :: t()

Registers catalog. Option: :transformers, applied in order.