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

Python: add restore method to chat_prompt_template #2495

Merged
merged 6 commits into from
Aug 23, 2023

Conversation

eavanvalkenburg
Copy link
Member

Motivation and Context

In order to add ways to save and restore a running conversation this adds a restore method and a property to the ChatPromptTemplate class.

Description

  1. Add messages property which provides a view to the role, message.template tuple
  2. Add restore classmethod that takes the same input as a regular init, but adds a list of tuples, it then loops through that list and adds each message.

Contribution Checklist

@eavanvalkenburg eavanvalkenburg requested a review from a team as a code owner August 18, 2023 12:35
@shawncal shawncal added the python Pull requests for the Python Semantic Kernel label Aug 18, 2023
@shawncal shawncal changed the title Ptyhon: add restore method to chat_prompt_template Python: Ptyhon: add restore method to chat_prompt_template Aug 18, 2023
@eavanvalkenburg eavanvalkenburg changed the title Python: Ptyhon: add restore method to chat_prompt_template Python: add restore method to chat_prompt_template Aug 18, 2023
@dluc dluc enabled auto-merge August 23, 2023 23:48
@dluc dluc added this pull request to the merge queue Aug 23, 2023
Merged via the queue into microsoft:main with commit 4e72b9d Aug 23, 2023
29 checks passed
SOE-YoungS pushed a commit to SOE-YoungS/semantic-kernel that referenced this pull request Nov 1, 2023
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
In order to add ways to save and restore a running conversation this
adds a restore method and a property to the ChatPromptTemplate class.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
1. Add messages property which provides a view to the role,
message.template tuple
2. Add restore classmethod that takes the same input as a regular init,
but adds a list of tuples, it then loops through that list and adds each
message.

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [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 😄

---------

Co-authored-by: Abby Harrison <54643756+awharrison-28@users.noreply.github.com>
Co-authored-by: Devis Lucato <dluc@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests for the Python Semantic Kernel
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants