Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net: Clean up some things in LiquidPromptTemplate and PromptyKernelExtensions #6118

Merged

Conversation

stephentoub
Copy link
Member

  • Liquid template parsing should happen during construction, not on each render
  • Liquid prompt template construction should fail for invalid templates
  • Default inputs should be evaluated once at Liquid template construction time
  • RenderAsync should capture any exceptions into returned Task
  • Role regex used in parsing rendered messages should be Compiled
  • LiquidPromptTemplateFactory should do arg validation and accomodate a PromptTemplateConfig whose TemplateFormat is null
  • Use XML comments instead of normal comments to describe properties in internal DOM
  • Remove unnecessary empty primary constructor
  • Use a regex to parse the components of a prompty template in order to a) more strictly validate contents but more importantly b) avoid losing part of the template when the separator appears in the contents itself
  • Clean up some XML comments
  • Set ModelId appropriately for openai
  • Avoid storing temperature/top_p in execution settings if they weren't specified
  • Add an OutputVariable if the prompty specifies one
  • Cache the default template factory rather than creating a new one on each construction

cc: @LittleLittleCloud

@stephentoub stephentoub requested a review from a team as a code owner May 3, 2024 15:51
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel labels May 3, 2024
@github-actions github-actions bot changed the title Clean up some things in LiquidPromptTemplate and PromptyKernelExtensions .Net: Clean up some things in LiquidPromptTemplate and PromptyKernelExtensions May 3, 2024
- Liquid template parsing should happen during construction, not on each render
- Liquid prompt template construction should fail for invalid templates
- Default inputs should be evaluated once at Liquid template construction time
- RenderAsync should capture any exceptions into returned Task
- Role regex used in parsing rendered messages should be Compiled
- LiquidPromptTemplateFactory should do arg validation and accomodate a PromptTemplateConfig whose TemplateFormat is null
- Use XML comments instead of normal comments to describe properties in internal DOM
- Remove unnecessary empty primary constructor
- Use a regex to parse the components of a prompty template in order to a) more strictly validate contents but more importantly b) avoid losing part of the template when the separator appears in the contents itself
- Clean up some XML comments
- Set ModelId appropriately for openai
- Avoid storing temperature/top_p in execution settings if they weren't specified
- Add an OutputVariable if the prompty specifies one
- Cache the default template factory rather than creating a new one on each construction
@markwallace-microsoft markwallace-microsoft merged commit 2f7110e into microsoft:feature-prompty May 3, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants