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: Replace IPromptTemplateEngine with IPromptTemplateFactory Update prompt rendering and template engine in dotnet samples #3348

Conversation

markwallace-microsoft
Copy link
Member

@markwallace-microsoft markwallace-microsoft commented Oct 31, 2023

Motivation and Context

Making this change to enable support for multiple prompt template formats
See https://github.com/microsoft/semantic-kernel/blob/main/docs/decisions/0014-custom-prompt-template-formats.md

Description

Contribution Checklist

Summary

This pull request updates the prompt rendering and template engine in the dotnet samples. Specifically, it replaces the PromptTemplate class with the BasicPromptTemplate class, updates the RunSemanticFunctionAsync method to use the new class, and removes the PromptTemplateEngineTests class which is now obsolete. Additionally, a new BasicPromptTemplateFactory class is introduced to create instances of the BasicPromptTemplate class.

Changes

  • Replaced PromptTemplate class with BasicPromptTemplate class
  • Updated RunSemanticFunctionAsync method to use BasicPromptTemplate class
  • Removed PromptTemplateEngineTests class as it is now obsolete
  • Introduced BasicPromptTemplateFactory class to create instances of BasicPromptTemplate class

Powered by Microsoft Semantic Kernel

@markwallace-microsoft markwallace-microsoft requested a review from a team as a code owner October 31, 2023 13:31
@shawncal shawncal added docs and tests Improvements or additions to documentation .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel kernel.core labels Oct 31, 2023
@github-actions github-actions bot changed the title Replace IPromptTemplateEngine with IPromptTemplateFactory .Net: Replace IPromptTemplateEngine with IPromptTemplateFactory Oct 31, 2023
@markwallace-microsoft
Copy link
Member Author

/sk generate-pr-description

@github-actions github-actions bot changed the title .Net: Replace IPromptTemplateEngine with IPromptTemplateFactory .Net: Replace IPromptTemplateEngine with IPromptTemplateFactory Update prompt rendering and template engine in dotnet samples Oct 31, 2023
Copy link

Generate PR Description: succeeded ✅
https://github.com/microsoft/semantic-kernel/actions/runs/6707266574

@markwallace-microsoft markwallace-microsoft force-pushed the users/markwallace/Add_IPromptTemplateFactory branch from 92c4264 to 535ec57 Compare October 31, 2023 14:35
Copy link
Member

@RogerBarreto RogerBarreto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes,

nit. Could not find the Factory.Factory test.

Found! 😊

@markwallace-microsoft markwallace-microsoft force-pushed the users/markwallace/Add_IPromptTemplateFactory branch from 1239cd1 to 60aeca9 Compare November 4, 2023 14:24
Copy link
Member

@RogerBarreto RogerBarreto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update Mark.

nit comments and small changes suggested.

@markwallace-microsoft markwallace-microsoft added this pull request to the merge queue Nov 6, 2023
Merged via the queue into microsoft:main with commit 23dd525 Nov 6, 2023
18 checks passed
@markwallace-microsoft markwallace-microsoft deleted the users/markwallace/Add_IPromptTemplateFactory branch November 6, 2023 18:16
stephentoub pushed a commit to stephentoub/semantic-kernel that referenced this pull request Nov 7, 2023
…e prompt rendering and template engine in dotnet samples (microsoft#3348)

### Motivation and Context

Making this change to enable support for multiple prompt template
formats
See
https://github.com/microsoft/semantic-kernel/blob/main/docs/decisions/0014-custom-prompt-template-formats.md

### Description


### Contribution Checklist

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄

## Summary
This pull request updates the prompt rendering and template engine in
the dotnet samples. Specifically, it replaces the PromptTemplate class
with the BasicPromptTemplate class, updates the RunSemanticFunctionAsync
method to use the new class, and removes the PromptTemplateEngineTests
class which is now obsolete. Additionally, a new
BasicPromptTemplateFactory class is introduced to create instances of
the BasicPromptTemplate class.

## Changes
- Replaced PromptTemplate class with BasicPromptTemplate class
- Updated RunSemanticFunctionAsync method to use BasicPromptTemplate
class
- Removed PromptTemplateEngineTests class as it is now obsolete
- Introduced BasicPromptTemplateFactory class to create instances of
BasicPromptTemplate class

---
*Powered by [Microsoft Semantic
Kernel](https://github.com/microsoft/semantic-kernel)*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs and tests Improvements or additions to documentation 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.

None yet

5 participants