Eai.Prompts (eai v0.1.15)

Copy Markdown

Prompt registry. Loads from config/prompts/*.exs at runtime.

Each file registers a single prompt entry under a :prompt_<name> key. Pattern mirrors config/tools/.

Summary

Functions

Get all registered prompts from config.

Extract system prompt text from prompt entry.

Get default prompt (:momoka — helpful generalist).

Look up prompt by :name atom.

Look up prompt by :name atom. Raises if not found.

Print formatted table of available prompts and their descriptions.

Get list of all registered prompt names (atoms).

Force reload prompt registry from config/prompts.exs.

Types

prompt_entry()

@type prompt_entry() :: keyword()

Functions

all()

@spec all() :: [prompt_entry()]

Get all registered prompts from config.

Loads from :persistent_term cache (set by reload/0).

Returns

List of prompt entries with keys: `:name`, `:content`, `:description`, etc.

content(name)

@spec content(atom()) :: String.t()

Extract system prompt text from prompt entry.

Options

  • name (atom) — Prompt name.

Returns

String content of the prompt.

default()

@spec default() :: prompt_entry()

Get default prompt (:momoka — helpful generalist).

Used when no explicit :prompt is provided to Chat.talk/1.

get(name)

@spec get(atom() | nil) :: prompt_entry() | nil

Look up prompt by :name atom.

Returns nil if not found. nil input returns default prompt.

Options

  • name (atom) — Prompt name: :momoka, :coder, :analyst, etc.

Example

iex> Eai.Prompts.get(:coder)
%{name: :coder, content: "You are a code expert...", ...}

get!(name)

@spec get!(atom()) :: prompt_entry()

Look up prompt by :name atom. Raises if not found.

Options

  • name (atom) — Prompt name.

Raises

ArgumentError if prompt not found.

list()

@spec list() :: :ok

Print formatted table of available prompts and their descriptions.

Example

iex> Eai.Prompts.list()

Available prompts:

  :momoka              Helpful generalist, concise
  :coder               Code analysis and refactoring
  :analyst             Research-focused, structured reasoning

names()

@spec names() :: [atom()]

Get list of all registered prompt names (atoms).

Example

iex> Eai.Prompts.names()
[:momoka, :coder, :analyst]

reload()

@spec reload() :: [prompt_entry()]

Force reload prompt registry from config/prompts.exs.

Returns all reloaded prompt entries.