A2UIAgent.DirectJson.Prompt (A2UIAgent v0.1.1)

Copy Markdown View Source

The system prompt snippet of the direct JSON format.

The snippet has three parts, separated by blank lines:

  1. ## Workflow Description: and workflow_rules/0;
  2. the schemas, between ---BEGIN A2UI JSON SCHEMA--- and ---END A2UI JSON SCHEMA--- lines (schema_prompt/2);
  3. ### Examples: and each example turn as an <a2ui-json> block, when there are examples.

Summary

Functions

Each example turn as an <a2ui-json> block, separated by blank lines; "" without examples. A message given as a Jason.OrderedObject keeps its key order.

Assembles the prompt snippet. Options: :examples (a list of turns, each a list of messages) and :allowed_messages (see schema_prompt/2).

The schemas that describe the catalogs to the model: the agent-to-renderer schema of the catalogs' protocol version (pruned to allowed_messages unless that is nil), the common types those schemas use, then one section per catalog document (A2UICore.Catalog.to_json/2), each as compact JSON. The protocol schemas keep the key order they are published in, and the catalog documents the order of the documents they were read from.

The workflow rules every direct JSON prompt starts with.

Functions

examples(turns)

(since 0.1.0)
@spec examples([[map()]] | nil) :: String.t()

Each example turn as an <a2ui-json> block, separated by blank lines; "" without examples. A message given as a Jason.OrderedObject keeps its key order.

generate(catalogs, options \\ [])

(since 0.1.0)
@spec generate([A2UICore.Catalog.t()], keyword()) ::
  {:ok, String.t()} | {:error, A2UICore.Error.t()}

Assembles the prompt snippet. Options: :examples (a list of turns, each a list of messages) and :allowed_messages (see schema_prompt/2).

schema_prompt(catalogs, allowed_messages \\ nil)

(since 0.1.0)
@spec schema_prompt([A2UICore.Catalog.t()], [String.t()] | nil) ::
  {:ok, String.t()} | {:error, A2UICore.Error.t()}

The schemas that describe the catalogs to the model: the agent-to-renderer schema of the catalogs' protocol version (pruned to allowed_messages unless that is nil), the common types those schemas use, then one section per catalog document (A2UICore.Catalog.to_json/2), each as compact JSON. The protocol schemas keep the key order they are published in, and the catalog documents the order of the documents they were read from.

The catalogs must be non-empty and share a protocol version.

workflow_rules()

(since 0.1.0)
@spec workflow_rules() :: String.t()

The workflow rules every direct JSON prompt starts with.