Declarative schema module that defines all DSL operations.
This module serves as the single source of truth for operation definitions, supporting validation, JSON Schema generation, and documentation.
Summary
Functions
Get operation definition by name.
Returns all operation definitions.
Generate a JSON Schema (draft-07) for the PTC DSL.
Generate a flattened JSON Schema optimized for LLM structured output.
Generate a concise prompt describing PTC operations for LLM text mode.
Returns a sorted list of valid operation names.
Functions
Get operation definition by name.
Arguments
- operation_name: The name of the operation
Returns
{:ok, definition}if the operation exists:errorif the operation is unknown
@spec operations() :: map()
Returns all operation definitions.
Returns
A map where keys are operation names and values are operation definitions.
@spec to_json_schema() :: map()
Generate a JSON Schema (draft-07) for the PTC DSL.
Returns
A map representing the JSON Schema that can be encoded to JSON.
@spec to_llm_schema() :: map()
Generate a flattened JSON Schema optimized for LLM structured output.
This schema uses anyOf to list all operations at the top level, avoiding
the recursive $ref patterns that LLMs struggle with. The schema is designed
to work with ReqLLM.generate_object! for structured output mode.
Returns
A map representing the flattened JSON Schema for the PTC DSL.
Generate a concise prompt describing PTC operations for LLM text mode.
This produces a human-readable description of operations suitable for system prompts. Includes operation reference, memory contract, key rules, and examples.
Options
:examples- number of full JSON examples to include (default: 3)
Returns
A string containing operation descriptions and examples.
@spec valid_operation_names() :: [String.t()]
Returns a sorted list of valid operation names.
Returns
A list of operation names in sorted order.