Skip to content

[FR] Add "metadata=" on role helper, add newPart helper. #311

@mbleigh

Description

@mbleigh

To allow prompts to annotate themselves with metadata, I propose two additions:

1. A metadata hash argument for the role and media helpers

{{role "system" metadata.foo="bar"}}
{{media url="..." metadata.foo="bar"}}

Note: I believe the metadata.foo syntax style is necessary because Handlebars doesn't support object literals. The algorithm should be to iterate through hash arguments for anything beginning with metadata.* and add each of those as metadata keys. Metadata should be merged with existing metadata (if any).

2. A newPart helper.

This helper creates a new text part with optional metadata:

{{newPart metadata.foo="bar"}}

This allows the user to create custom "sections" within their prompt for better observability and understanding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions