DotPrompt

A high-performance, native Elixir compiler for the DotPrompt language.

Installation

The package can be installed by adding dot_prompt to your list of dependencies in mix.exs:

def deps do
  [
    {:dot_prompt, "~> 1.0.0"}
  ]
end

Usage

Compilation

{:ok, result} = DotPrompt.compile("my_prompt", %{name: "John"})
IO.puts(result.prompt)

Rendering

{:ok, result} = DotPrompt.render("my_prompt", %{name: "John"}, %{weather: "sunny"})
IO.puts(result.prompt)

Schema Extraction

{:ok, schema} = DotPrompt.schema("my_prompt")

Configuration

You can configure the prompts directory in your config/config.exs:

config :dot_prompt,
  prompts_dir: "priv/prompts"

Features