[REFACTOR]: Decouple PromptTemplate creation from YAML - #156
Merged
Spencer Schoenberg (spencrr) merged 1 commit intoAug 7, 2026
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
This was referenced Aug 6, 2026
Nina Chikanov (nina-msft)
approved these changes
Aug 7, 2026
Nina Chikanov (nina-msft)
left a comment
Contributor
There was a problem hiding this comment.
This looks like a great implementation based off of my feedback from previous PR! I did not get a chance to run this through GHCP because it is being very slow for me today - so if you haven't done a self-review through that it may be worth to make sure we didn't miss anything.
Otherwise, small feedback re: exception handling and otherwise I think the direction looks good. Up to you if you'd also like Bashir Partovi (@bashirpartovi) to take a look before merge.
Spencer Schoenberg (spencrr)
deleted the
dev/spencrr/refactor-prompt-template-creation
branch
August 8, 2026 01:54
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.
Description
This supersedes the constructor approaches in #132 and #144 and follows the review feedback on #144.
This PR makes prompt-template construction source-neutral while retaining
PromptTemplate.from_yaml(path)as the YAML and filesystem adapter.PromptTemplateDefinition.PromptTemplate(definition=...).PromptTemplate.from_yaml(path)and both existing production call sites.Jinja receives neither the YAML path nor the logical template name. This avoids incorrect YAML file/line attribution and prevents names such as
summary.htmlfrom unexpectedly enabling autoescape.Breaking changes
Direct component-wise construction is no longer accepted:
Construct from a validated definition instead:
PromptTemplate.from_yaml(path)is unchanged, so existing supported call sites require no migration.Separate
PromptTemplateinstances now use identity equality and hashing rather than metadata-based structural equality.PromptTemplateDefinitionError.pathis optional for in-memory construction.Checklist
pre-commit run --all-filespasses