Prompt.load()

Load a prompt from a .md file and render it via from_template().

Usage

Source

Prompt.load(
    name,
    *,
    base=None,
    **vars,
)

Resolution searches directories in order, returning the first existing file: the base directory if given (otherwise a prompts/ directory beside the calling module), then the framework’s bundled captain_hook/prompts/. The file path is <dir>/<name>.md; name may contain / to nest.

Parameters

name: str

Prompt name without the .md suffix; may include / for nesting.

base: str | Path | None = None

Optional directory to search instead of the caller-relative prompts/.

**vars: object
Template variables substituted into the file via str.format_map.

Returns

A: Prompt
class:Prompt whose system text is the rendered file contents.

Raises

FileNotFoundError

If no matching file exists in any searched directory.

KeyError
If the file references a placeholder not supplied in **vars.