feat: add metadata support to role markers in dotprompt#563
Open
feat: add metadata support to role markers in dotprompt#563
Conversation
Extend the `role` helper to accept key-value metadata pairs via
Handlebars hash arguments (e.g., `{{role "user" purpose="preamble"}}`).
Update the role marker format, regex, and parsing logic to encode,
split, and extract metadata. Propagate parsed metadata into message
objects via a new optional `metadata` field on messages.
Add support for passing key=value metadata to the `{{role}}` Handlebars
helper (e.g. `{{role "user" purpose="preamble"}}`). The metadata is
encoded into the role marker string, parsed back during message
construction, and stored in a new `Metadata` field on `Message`. Updates
the regex, adds `parseRoleMarker`, and includes spec tests.
Add support for passing metadata via hash parameters in the `{{role}}`
helper (e.g. `{{role "user" purpose="preamble"}}`). Metadata key-value
pairs are serialized into the role marker, parsed during message
construction, and attached to the resulting Message object. Also adds
spec test assertions for metadata on messages.
…bilities Add and update constraint dependencies to fix multiple security advisories including vulnerabilities in nbconvert, pytest, requests, tornado, pygments, and uv. Remove resolved advisory from pysentry while_no_fix ignore list.
Remove `-e` editable install entries for `dotpromptz` and `handlebarrz` from the exported requirements.txt, keeping only the dependency comments for workspace resolution.
Collaborator
Author
|
cc @apascal07 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds metadata support to the
rolehelper.Allow the
{{role}}helper to carry key-value metadata via Handlebars hash arguments:This lets prompt authors annotate message boundaries with arbitrary metadata (e.g., marking a message's purpose for downstream consumers or signaling cache breakpoints) without changing the message content itself. The metadata is encoded into the existing role marker format, parsed during message splitting, and surfaced on the
Message.metadatafield.Implemented across JS, Go, and Dart with shared spec tests in
spec/helpers/role_metadata.yaml.Also pins 6 vulnerable Python transitive dependencies (
nbconvert,pytest,requests,tornado,pygments,uv) to patched versions and regenerates the lock/requirements files... just to make python presubmits pass.