Python: implement KernelContent and all related classes#4491
Merged
moonbox3 merged 39 commits intomicrosoft:mainfrom Jan 30, 2024
Merged
Python: implement KernelContent and all related classes#4491moonbox3 merged 39 commits intomicrosoft:mainfrom
moonbox3 merged 39 commits intomicrosoft:mainfrom
Conversation
moonbox3
reviewed
Jan 5, 2024
python/semantic_kernel/connectors/ai/open_ai/open_ai_response.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/open_ai/open_ai_response.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/open_ai/open_ai_response.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/open_ai/open_ai_response.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/open_ai/open_ai_response.py
Outdated
Show resolved
Hide resolved
981a886 to
edb8885
Compare
22e5eee to
7c4486a
Compare
moonbox3
reviewed
Jan 16, 2024
Collaborator
moonbox3
left a comment
There was a problem hiding this comment.
Really nice work on all of this.
python/semantic_kernel/models/contents/streaming_chat_message_content.py
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/open_ai/responses/azure_chat_message_content.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/open_ai/responses/azure_streaming_chat_message_content.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/open_ai/services/azure_config_base.py
Outdated
Show resolved
Hide resolved
python/tests/unit/ai/google_palm/services/test_palm_chat_completion.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/open_ai/services/open_ai_handler.py
Outdated
Show resolved
Hide resolved
9941cd5 to
8852b0b
Compare
moonbox3
reviewed
Jan 23, 2024
Collaborator
moonbox3
left a comment
There was a problem hiding this comment.
I don't see anything major right now. It's all looking good!
python/semantic_kernel/connectors/ai/open_ai/services/azure_chat_completion.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/open_ai/services/open_ai_chat_completion_base.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/open_ai/services/open_ai_chat_completion_base.py
Outdated
Show resolved
Hide resolved
python/samples/kernel-syntax-examples/openai_function_calling.py
Outdated
Show resolved
Hide resolved
juliomenendez
requested changes
Jan 24, 2024
Contributor
juliomenendez
left a comment
There was a problem hiding this comment.
Looks good, just a couple comments
python/semantic_kernel/connectors/ai/ollama/services/ollama_chat_completion.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/open_ai/contents/azure_streaming_chat_message_content.py
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/open_ai/contents/azure_streaming_chat_message_content.py
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/open_ai/semantic_functions/open_ai_chat_prompt_template.py
Show resolved
Hide resolved
9b99b7e to
cfd280c
Compare
358099d to
93869a8
Compare
moonbox3
approved these changes
Jan 30, 2024
Bryan-Roe
pushed a commit
to Bryan-Roe-ai/semantic-kernel
that referenced
this pull request
Oct 6, 2024
### 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. --> As we are preparing to move towards v1 where the context no longer is used, we need a better way of handling the responses from models and capture them in a more structured way, also in preparation of multi-modal models and the like. Closes microsoft#4598 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Added KernelContent and StreamingKernelContent base classs, consistent with the dotnet versions of those. Subclasses of this class for specific services, for instance, the OpenAI class has parsing for the content, function_calls, tool_calls in it, and the Azure OpenAI one has parsing for the context in it. ### 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 - [ ] I didn't break anyone 😄
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.
Motivation and Context
As we are preparing to move towards v1 where the context no longer is used, we need a better way of handling the responses from models and capture them in a more structured way, also in preparation of multi-modal models and the like.
Closes #4598
Description
Added KernelContent and StreamingKernelContent base classs, consistent with the dotnet versions of those.
Subclasses of this class for specific services, for instance, the OpenAI class has parsing for the content, function_calls, tool_calls in it, and the Azure OpenAI one has parsing for the context in it.
Contribution Checklist