OpenUI.Prompt (OpenUI v0.1.1)

Copy Markdown View Source

Generates the system prompt that teaches a model a library (prompt.md, section 4). For the same library and options the prompt is byte-identical to the official generateSystemPrompt.

OpenUI.Prompt.generate(MyApp.Library, tools: ["list_tickets"], edit_mode: true)

Options:

  • :tools: tool names, or maps %{name:, description:, input_schema:, output_schema:}. Schemas may be JSON text, OpenUI.JSON.Object or maps; a plain map lists its properties in key order, so use one of the first two to keep the order you wrote.
  • :tool_calls: teaches Query, Mutation and @Run. Defaults to true when :tools is given.
  • :bindings: teaches $variables, @Set and @Reset. Defaults to :tool_calls.
  • :builtin_functions: lists the built-in functions even when the two options above are off.
  • :edit_mode, :inline_mode: teach edits by changed statements and prose with fenced code.
  • :preamble, :examples, :tool_examples, :additional_rules: text the host adds.

Summary

Functions

Generates the system prompt for a library.

Functions

generate(library, opts \\ [])

@spec generate(OpenUI.Library.t() | module(), keyword()) :: String.t()

Generates the system prompt for a library.