Update: We have released a new NuGet Gallery | Microsoft.SemanticKernel 1.18.1-rc release candidate which has been updated to depend on NuGet Gallery | OpenAI 2.0.0-beta.10 and NuGet Gallery | Azure.AI.OpenAI 2.0.0-beta.3.
Today we are announcing that support for Azure.AI.OpenAI and OpenAI v2 .NET SDK is available in the Semantic Kernel v1.18.0-rc release candidate. This release supports the official OpenAI library for .NET which Microsoft announced 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.
We have published an OpenAI Connector Migration Guide | Microsoft Learn which will guide you through the steps to upgrade to this new release.
Note: This change only applies to the .NET version of the Semantic Kernel.
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Â
OpenAIClient
type previously was Azure specific namespace type but now it is anOpenAI
 SDK namespace type, you will need to update your code to use the newÂOpenAIClient
type. - When using Azure, you will need to update your code to use the newÂ
AzureOpenAIClient
 type. -
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.
Also note that the following features have been deprecated in the new v2 Azure.AI.OpenAI SDK:
- TheÂ
TextGeneration
 modality was deprecated in the latest version of the OpenAI Connector. You will need to update your code to useÂChatCompletion
 modality instead. Keep in mind that theÂChatCompletion
 services also implement theÂTextGeneration
interface and that may not require any changes to your code if you were targeting theÂITextGenerationService
 interface. - The lastestÂ
OpenAI
 SDK does not support multiple choices anymore. The option for multiple results was removed also from theÂOpenAIPromptExecutionSettings
. So any implementation that was relying on multiple choices will need to be updated. - TheÂ
OpenAIFileService
 was deprecated in the latest version of the OpenAI Connector. We strongly recommend to update your code to use the newÂOpenAIClient.GetFileClient()
 for file management operations.
What happens next!
We have released Semantic Kernel v1.18.0-rc as a pre-release to give our customers time to provide feedback on the upgrade process and any issues that may arise as a result of our adoption of the Azure.AI.OpenAI and OpenAI v2 .NET SDK’s.
If you take automatic updates of Semantic Kernel v1 this release will not be automatically selected because it is a pre-release. You will need to explicitly opt-in to take the pre-release version and make the required code changes as described in the OpenAI Connector Migration Guide | Microsoft Learn.
Our plan is to gather feedback over the next couple of weeks and then publish an official v1.18.1 release. The current target date is the 27th August 2024. If you take automatic updates and want to delay updating to the v1.18.1 release then you can stay on the v1.17.* versions until you are ready. For more information see NuGet Package Version Reference | Microsoft Learn.
In the meantime if there are any urgent changes required in the Semantic Kernel we will include these in patch releases to the current version 1.17.1 release.
If you have any questions please create an issue here Issues · microsoft/semantic-kernel (github.com).
0 comments