[MS] Support for Azure.AI.OpenAI and OpenAI v2 is coming - devamazonaws.blogspot.com
Microsoft announced the official OpenAI library for .NET at the Build 2024 conference. This new SDK ensures that .NET developers have parity with other programming language libraries when accessing Azure OpenAI models. This means the new SDK will be able to support the latest OpenAI features and models as soon as they come out, such as GPT4o and Assistants v2, by providing a unified experience across OpenAI and Azure OpenAI. Since the release of the official OpenAI library for .NET, the Semantic Kernel team has been working on updating our existing OpenAI connectors to use the new V2 OpenAI library and Azure.AI.OpenAI library. This is a significant update to Semantic Kernel. Once complete, it will enable developers to upgrade their projects to the v2 libraries from OpenAI and Azure OpenAI.
Post Updated on July 30, 2024 at 09:34AM
Thanks for reading
from devamazonaws.blogspot.com
What to expect when you upgrade
Since the new .NET Azure.AI.OpenAI SDK has done a major version upgrade from v1 to v2, there have been significant updates to the underlying APIs. For developers that use this SDK directly, there are several breaking changes that must be accounted for. The good news for Semantic Kernel developers though is that our abstractions isolate your code from the vast majority of these changes. There are, however, a few unavoidable breaking changes to be aware of that are a result of the upgrade, but these changes primarily impact more advanced use cases.The one required change...
The one change that most Semantic Kernel customers will need to make is updating the name of the library you import. Because there are now two libraries that connect to OpenAI models (Azure.AI.OpenAI and the official OpenAI library), we chose to update the name of Semantic Kernel's connectors to better reflect those differences. There are now two different connector libraries:Microsoft.SemanticKernel.Connectors.OpenAI and Microsoft.SemanticKernel.Connectors.AzureOpenAI. If you used the Microsoft.SemanticKernel.Connectors.OpenAI library to connect to Azure OpenAI, you'll want to update it to the Microsoft.SemanticKernel.Connectors.AzureOpenAI library. Additional details about the decisions related to naming and structure are documented here.
Changes that impact advanced scenarios
If you are using more advanced scenarios that require direct usage of the APIs in the Azure.AI.OpenAI SDK, you'll need to be aware of the following changes that Azure introduced when they moved to v2:- The
OpenAIClienttype previously was a Azure specific namespace type but now it is anOpenAISDK namespace type, you will need to update your code to use the newOpenAIClienttype. - When using Azure, you will need to update your code to use the new
AzureOpenAIClienttype. -
With the new
AzureOpenAIClient, you can now specify your datasource thru the options and that requires a small change in your code to the new type.
- The
TextGenerationmodality was deprecated in the latest version of the OpenAI Connector. You will need to update your code to useChatCompletionmodality instead. Keep in mind that theChatCompletionservices also implement theTextGenerationinterface and that may not require any changes to your code if you were targetting theITextGenerationServiceinterface. - The lastest
OpenAISDK does not support multiple choices anymore. The option for multiple results was removed also from theOpenAIPromptExecutionSettings. So any implementation that was relying on multiple choices will need to be updated. - The
OpenAIFileServicewas deprecated in the latest version of the OpenAI Connector. We strongly recommend to update your code to use the newOpenAIClient.GetFileClient()for file management operations.
We'll be there every step of the way!
Uptalking a major update can be challenging, but we in the Semantic Kernel team want to make it as painless as possible. As we get closer to adopting the new v2 libraries, we will provide a detailed migration guide to help you with the process of upgrading your code. In the feature branch where we're updating the connectors, we've already made the required changes to our samples (see microsoft/semantic-kernel at feature-connectors-openai). In most cases, the updates just required adding a new using statement for the Microsoft.SemanticKernel.Connectors.AzureOpenAI library, which shows the value of having an abstraction layer like Semantic Kernel between you and the underlying SDKs.Post Updated on July 30, 2024 at 09:34AM
Thanks for reading
from devamazonaws.blogspot.com
Comments
Post a Comment