DotPrompt (anantha_dot_prompt v1.1.0)
Copy MarkdownMain API for dot-prompt.
Summary
Functions
Returns statistics about the current cache usage.
Compiles a prompt for given params. Returns {:ok, %DotPrompt.Result{}} or {:error, map()}
Internal compile that returns iodata for maximum efficiency when nesting fragments.
Invalidates all caches (structural, fragment, and vary).
Invalidates the cache for a specific prompt.
Lists only fragment prompts.
Lists all available prompts including fragments.
Lists only root-level prompts (excluding fragments).
Renders a prompt by compiling it and injecting runtime data.
Extracts the schema and metadata for a given prompt.
Validates an LLM response against a response contract.
Types
Functions
Returns statistics about the current cache usage.
@spec compile(prompt_name() | String.t(), params(), compile_opts()) :: {:ok, DotPrompt.Result.t()} | {:error, map()}
Compiles a prompt for given params. Returns {:ok, %DotPrompt.Result{}} or {:error, map()}
@spec compile_to_iodata(prompt_name() | String.t(), params(), compile_opts()) :: {:ok, iodata(), map(), MapSet.t(), map(), boolean(), [String.t()], map() | nil, integer(), integer() | String.t(), map()} | {:error, map()}
Internal compile that returns iodata for maximum efficiency when nesting fragments.
@spec invalidate_all_cache() :: :ok
Invalidates all caches (structural, fragment, and vary).
@spec invalidate_cache(prompt_name()) :: :ok
Invalidates the cache for a specific prompt.
@spec list_fragment_prompts() :: [prompt_name()]
Lists only fragment prompts.
@spec list_prompts(keyword()) :: [prompt_name()]
Lists all available prompts including fragments.
@spec list_root_prompts() :: [prompt_name()]
Lists only root-level prompts (excluding fragments).
@spec render(prompt_name() | String.t(), params(), runtime(), compile_opts()) :: {:ok, DotPrompt.Result.t()} | {:error, map()}
Renders a prompt by compiling it and injecting runtime data.
@spec schema(prompt_name(), integer() | nil, keyword()) :: {:ok, schema_info()} | {:error, map()}
Extracts the schema and metadata for a given prompt.
Validates an LLM response against a response contract.