[Dotprompt] Add support for partials
mbleigh opened this issue · comments
Handlebars partials make composition easy, and we should support it in Dotprompt. Proposed implementation:
- Partials are stored in the prompt directory and prefixed with a
_
. - Partials do not have YAML frontmatter.
- Partials are available to all prompts by name (omitting the
_
). - Partials follow standard Handlebars conventions for passing arguments etc.
Let's say I have information about the user that I want to include in many prompts. I create _userMeta.prompt
in my prompts directory with the following content:
I can then use this in any other prompt by passing in appropriate context data: