Python: Enable core skills, retry mechanisms and template engine protocols to be used as pydantic fields#2287
Merged
awharrison-28 merged 4 commits intomicrosoft:mainfrom Aug 3, 2023
Conversation
Yet to upgrade: - ConversationSummarySkill - WebSearchEngineSkill Reason: They contain data, and thus need to be pydantic models. Tests: - Added test to ensure that upgraded skills are valid pydantic fields and can be serialized.
This folder contains a single file. Doesn't make sense to put up a separate PR for this.
mkarle
approved these changes
Aug 2, 2023
Contributor
Author
|
I thought that the PR was getting too big and that I should move it to a
separate PR, but now that I say it, I realize it sounds very silly. I will
update this pr with those changes as well. Thank you for pointing this out.
…On Wed, Aug 2, 2023 at 4:54 PM Mark Karle ***@***.***> wrote:
***@***.**** approved this pull request.
------------------------------
In python/tests/unit/test_serialization.py
<#2287 (comment)>
:
> +from semantic_kernel.core_skills.web_search_engine_skill import WebSearchEngineSkill
+from semantic_kernel.sk_pydantic import PydanticField, SKBaseModel
+from semantic_kernel.template_engine.protocols.code_renderer import CodeRenderer
+from semantic_kernel.template_engine.protocols.prompt_templating_engine import (
+ PromptTemplatingEngine,
+)
+from semantic_kernel.template_engine.protocols.text_renderer import TextRenderer
+
+PydanticFieldT = t.TypeVar("PydanticFieldT", bound=PydanticField)
+
+
***@***.***(
+ "sk_type",
+ [
+ pytest.param(
+ ConversationSummarySkill, marks=pytest.mark.xfail(reason="Contains data")
Why does the conversation summary skill not get serialized if it contains
data?
—
Reply to this email directly, view it on GitHub
<#2287 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABI5YNKJRZKML3QAE53IN73XTLSCFANCNFSM6AAAAAA3BW4ZHU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
awharrison-28
approved these changes
Aug 3, 2023
Contributor
awharrison-28
left a comment
There was a problem hiding this comment.
Per offline discussion, ConversationSummarySkill and WebSearchEngineSkill will be addressed in a separate PR
SOE-YoungS
pushed a commit
to SOE-YoungS/semantic-kernel
that referenced
this pull request
Nov 1, 2023
…ocols to be used as pydantic fields (microsoft#2287) ### Summary This is part 1 of the Serialization work for semantic kernel. Corresponding issue: microsoft#131 ### Motivation and Context This PR allows core skills (all except 2), retry mechanisms and template engine protocols to be used as valid pydantic fields. This allows me to convert the classes that depend on these classes to pydantic models, and thus be able to serialize them. No user facing code changes are expected from this PR. <!-- 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. --> ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 <abharris@microsoft.com>
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.
Summary
This is part 1 of the Serialization work for semantic kernel.
Corresponding issue: #131
Motivation and Context
This PR allows core skills (all except 2), retry mechanisms and template engine protocols to be used
as valid pydantic fields. This allows me to convert the classes that depend on these classes to pydantic
models, and thus be able to serialize them.
No user facing code changes are expected from this PR.
Description
Contribution Checklist