-
Notifications
You must be signed in to change notification settings - Fork 4k
Python: Refactoring and fix bug. AuthorRole instead of string literals. #6391
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: Refactoring and fix bug. AuthorRole instead of string literals. #6391
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hi @stefan521, could you resolve the one file conflict, please? Thanks! |
# Conflicts: # python/semantic_kernel/connectors/ai/ollama/services/ollama_chat_completion.py
Python 3.10 Test Coverage Report •
Python 3.10 Unit Test Overview
|
Hi @moonbox3 , thanks for reviewing! I've solved the conflicts. |
python/tests/unit/contents/test_streaming_chat_message_content.py
Outdated
Show resolved
Hide resolved
Head branch was pushed to by a user without write access
@stefan521 sorry, I think I wasn't clear enough, I like that most tests run with AuthorRole... but there need to be some with a str (one per type) so that we know both ways of creating them work! |
@eavanvalkenburg got it! I’ll update the PR tonight. Thanks for reviewing! |
…s. (microsoft#6391) ### 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. --> There's an enum called `AuthorRole`. I replaced string literals with the enum values. PyCharm highlights this in some cases: Expected type 'AuthorRole', got 'str' instead I also fixed a bug in _function_invocation_filters_stream.py_ where the argument name was wrong. `author="assistant"` instead of `role="assistant"` ### 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: Evan Mattson <35585003+moonbox3@users.noreply.github.com> Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
Motivation and Context
There's an enum called
AuthorRole
. I replaced string literals with the enum values. PyCharm highlights this in some cases: Expected type 'AuthorRole', got 'str' insteadI also fixed a bug in function_invocation_filters_stream.py where the argument name was wrong.
author="assistant"
instead ofrole="assistant"
Description
Contribution Checklist