-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 Fix Add Missing OpenAI Connector Choice properties to Metadata #5655
Merged
RogerBarreto
merged 27 commits into
microsoft:main
from
RogerBarreto:issues/5289-openai-finish-reason-metadata
Mar 26, 2024
Merged
.Net Fix Add Missing OpenAI Connector Choice properties to Metadata #5655
RogerBarreto
merged 27 commits into
microsoft:main
from
RogerBarreto:issues/5289-openai-finish-reason-metadata
Mar 26, 2024
Conversation
This file contains 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
markwallace-microsoft
added
.NET
Issue or Pull requests regarding .NET code
kernel
Issues or pull requests impacting the core kernel
labels
Mar 26, 2024
SergeyMenshykh
approved these changes
Mar 26, 2024
…ithub.com/RogerBarreto/semantic-kernel into issues/5289-openai-finish-reason-metadata
markwallace-microsoft
approved these changes
Mar 26, 2024
@RogerBarreto do you think about introduce same pattern for metadata like is in Gemini and HuggingFace? It would be nice have inteliisense support. |
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Mar 26, 2024
@Krzysztof318 That's a good suggestion, not in the plans on changing the current OpenAI connector as some other updates will come from Azure on that regard. We will eventually splitting Azure from OpenAI specific connectors. |
4 tasks
LudoCorporateShark
pushed a commit
to LudoCorporateShark/semantic-kernel
that referenced
this pull request
Aug 25, 2024
…icrosoft#5655) ## Description Resolves microsoft#5289 This pull request includes changes to both the `dotnet/samples/KernelSyntaxExamples/Example43_GetModelResult.cs` and `dotnet/src/Connectors/Connectors.OpenAI/AzureSdk/ClientCore.cs` files. The changes mainly focus on improving the handling of metadata and simplifying the codebase. Changes in `Example43_GetModelResult.cs`: * The method `GetTokenUsageMetadataAsync()` was modified to use implicit type (`var`) instead of explicit type (`Kernel`) when creating a kernel. This change simplifies the code and makes it more readable. * A new method `GetFullModelMetadataAsync()` was added. This method creates a kernel, defines a function, invokes the function through the kernel, and displays the results. This addition expands the functionality of the class. Changes in `ClientCore.cs`: * The method `ClientCore()` was modified to use `GetTextChoiceMetadata()` instead of `GetChoiceMetadata()`. This change improves the handling of metadata. * The method `GetStreamingTextContentsAsync()` was also modified to use `GetTextChoiceMetadata()` instead of `GetChoiceMetadata()`. This change improves the handling of metadata. * The methods `GetTextChoiceMetadata()`, `GetChatChoiceMetadata()`, and `GetResponseMetadata()` were modified to include additional metadata fields. This change improves the amount of information available in the metadata. * The method `AddResponseMessage()` was modified to handle `null` values for `finishReason`. This change improves the robustness of the code. Changes in `AzureOpenAIChatCompletionServiceTests.cs`: * The method `GetStreamingChatMessageContentsWorksCorrectlyAsync()` was modified to use an enumerator instead of a foreach loop. This change simplifies the code and makes it more readable. Changes in `chat_completion_streaming_test_response.txt`: * The test response was modified to include additional data. This change improves the accuracy of the tests.
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.
Description
Resolves #5289
Resolves #5240
This pull request includes changes to both the
dotnet/samples/KernelSyntaxExamples/Example43_GetModelResult.cs
anddotnet/src/Connectors/Connectors.OpenAI/AzureSdk/ClientCore.cs
files. The changes mainly focus on improving the handling of metadata and simplifying the codebase.Changes in
Example43_GetModelResult.cs
:GetTokenUsageMetadataAsync()
was modified to use implicit type (var
) instead of explicit type (Kernel
) when creating a kernel. This change simplifies the code and makes it more readable.GetFullModelMetadataAsync()
was added. This method creates a kernel, defines a function, invokes the function through the kernel, and displays the results. This addition expands the functionality of the class.Changes in
ClientCore.cs
:ClientCore()
was modified to useGetTextChoiceMetadata()
instead ofGetChoiceMetadata()
. This change improves the handling of metadata.GetStreamingTextContentsAsync()
was also modified to useGetTextChoiceMetadata()
instead ofGetChoiceMetadata()
. This change improves the handling of metadata.GetTextChoiceMetadata()
,GetChatChoiceMetadata()
, andGetResponseMetadata()
were modified to include additional metadata fields. This change improves the amount of information available in the metadata.AddResponseMessage()
was modified to handlenull
values forfinishReason
. This change improves the robustness of the code.Changes in
AzureOpenAIChatCompletionServiceTests.cs
:GetStreamingChatMessageContentsWorksCorrectlyAsync()
was modified to use an enumerator instead of a foreach loop. This change simplifies the code and makes it more readable.Changes in
chat_completion_streaming_test_response.txt
: