{"id":3185,"date":"2024-08-13T12:27:26","date_gmt":"2024-08-13T19:27:26","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/semantic-kernel\/?p=3185"},"modified":"2024-08-27T13:08:23","modified_gmt":"2024-08-27T20:08:23","slug":"support-for-azure-ai-openai-and-openai-v2-is-here","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/agent-framework\/support-for-azure-ai-openai-and-openai-v2-is-here\/","title":{"rendered":"Support for Azure.AI.OpenAI and OpenAI v2 is here"},"content":{"rendered":"<p><strong>Update:<\/strong> We have released a new <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.SemanticKernel\/1.18.1-rc\">NuGet Gallery | Microsoft.SemanticKernel 1.18.1-rc<\/a> release candidate which has been updated to depend on <a href=\"https:\/\/www.nuget.org\/packages\/OpenAI\/2.0.0-beta.10\">NuGet Gallery | OpenAI 2.0.0-beta.10<\/a> and <a href=\"https:\/\/www.nuget.org\/packages\/Azure.AI.OpenAI\/2.0.0-beta.3\">NuGet Gallery | Azure.AI.OpenAI 2.0.0-beta.3<\/a>.<\/p>\n<p>Today we are announcing that support for Azure.AI.OpenAI and OpenAI v2 .NET SDK is available in the <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.SemanticKernel\/1.18.0-rc\">Semantic Kernel v1.18.0-rc<\/a> release candidate. This release supports the <a href=\"https:\/\/www.youtube.com\/watch?v=GUV2p_9QUo8\">official OpenAI library for .NET<\/a> 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.<\/p>\n<p>We have published an <span data-teams=\"true\"><span class=\"ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak\" dir=\"ltr\"><a id=\"menurce8\" class=\"fui-Link ___1rxvrpe f2hkw1w f3rmtva f1ewtqcl fyind8e f1k6fduh f1w7gpdv fk6fouc fjoy568 figsok6 f1hu3pq6 f11qmguv f19f4twv f1tyq0we f1g0x7ka fhxju0i f1qch9an f1cnd47f fqv5qza f1vmzxwi f1o700av f13mvf36 f1cmlufx f9n3di6 f1ids18y f1tx3yz7 f1deo86v f1eh06m1 f1iescvh fhgqx19 f1olyrje f1p93eir f1nev41a f1h8hb77 f1lqvz6u f10aw75t fsle3fq f17ae5zn\" title=\"https:\/\/learn.microsoft.com\/en-us\/semantic-kernel\/support\/v2-openai-migration-guide\" href=\"https:\/\/learn.microsoft.com\/en-us\/semantic-kernel\/support\/v2-openai-migration-guide\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Link OpenAI Connector Migration Guide | Microsoft Learn\">OpenAI Connector Migration Guide | Microsoft Learn<\/a><\/span><\/span> which will guide you through the steps to upgrade to this new release.<\/p>\n<p><strong>Note: This change only applies to the .NET version of the Semantic Kernel.<\/strong><\/p>\n<p>&nbsp;<\/p>\n<h2>What to expect when you upgrade<\/h2>\n<p>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.<\/p>\n<h3><\/h3>\n<p>&nbsp;<\/p>\n<h3>The one required change&#8230;<\/h3>\n<p>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 <em>two<\/em> libraries that connect to OpenAI models (Azure.AI.OpenAI and the official OpenAI library), we chose to update the name of Semantic Kernel&#8217;s connectors to better reflect those differences. There are now two different connector libraries: <code>Microsoft.SemanticKernel.Connectors.OpenAI<\/code> and <code>Microsoft.SemanticKernel.Connectors.AzureOpenAI<\/code>. If you used the\u00a0 <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.SemanticKernel.Connectors.OpenAI\">Microsoft.SemanticKernel.Connectors.OpenAI<\/a> library to connect to Azure OpenAI, you&#8217;ll want to update it to the Microsoft.SemanticKernel.Connectors.AzureOpenAI library. Additional details about the decisions related to naming and structure are documented <a href=\"https:\/\/github.com\/microsoft\/semantic-kernel\/blob\/main\/docs\/decisions\/0047-azure-open-ai-connectors.md\">here<\/a>.<\/p>\n<h3><\/h3>\n<p>&nbsp;<\/p>\n<h3>Changes that impact advanced scenarios<\/h3>\n<p>If you are using more advanced scenarios that require direct usage of the APIs in the Azure.AI.OpenAI SDK, you&#8217;ll need to be aware of the following changes that Azure introduced when they moved to v2:<\/p>\n<ul>\n<li>The\u00a0<code>OpenAIClient<\/code> type previously was Azure specific namespace type but now it is an <code>OpenAI<\/code>\u00a0SDK namespace type, you will need to update your code to use the new\u00a0<code>OpenAIClient<\/code> type.<\/li>\n<li>When using Azure, you will need to update your code to use the new\u00a0<code>AzureOpenAIClient<\/code>\u00a0type.<\/li>\n<li>\n<p dir=\"auto\">With the new\u00a0<code>AzureOpenAIClient<\/code>, you can now specify your datasource thru the options and that requires a small change in your code to the new type.<\/p>\n<\/li>\n<\/ul>\n<p>Also note that the following features have been deprecated in the new v2 Azure.AI.OpenAI SDK:<\/p>\n<ul>\n<li>The\u00a0<code>TextGeneration<\/code>\u00a0modality was deprecated in the latest version of the OpenAI Connector. You will need to update your code to use\u00a0<code>ChatCompletion<\/code>\u00a0modality instead. Keep in mind that the\u00a0<code>ChatCompletion<\/code>\u00a0services also implement the\u00a0<code>TextGeneration<\/code> interface and that may not require any changes to your code if you were targeting the\u00a0<code>ITextGenerationService<\/code>\u00a0interface.<\/li>\n<li>The lastest\u00a0<code>OpenAI<\/code>\u00a0SDK does not support multiple choices anymore. The option for multiple results was removed also from the\u00a0<code>OpenAIPromptExecutionSettings<\/code>. So any implementation that was relying on multiple choices will need to be updated.<\/li>\n<li>The\u00a0<code>OpenAIFileService<\/code>\u00a0was deprecated in the latest version of the OpenAI Connector. We strongly recommend to update your code to use the new\u00a0<code>OpenAIClient.GetFileClient()<\/code>\u00a0for file management operations.<\/li>\n<\/ul>\n<h2><\/h2>\n<p>&nbsp;<\/p>\n<h2>What happens next!<\/h2>\n<p>We have released <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.SemanticKernel\/1.18.0-rc\">Semantic Kernel v1.18.0-rc<\/a> 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&#8217;s.<\/p>\n<p>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 <span data-teams=\"true\"><span class=\"ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak\" dir=\"ltr\"><a id=\"menurce8\" class=\"fui-Link ___1rxvrpe f2hkw1w f3rmtva f1ewtqcl fyind8e f1k6fduh f1w7gpdv fk6fouc fjoy568 figsok6 f1hu3pq6 f11qmguv f19f4twv f1tyq0we f1g0x7ka fhxju0i f1qch9an f1cnd47f fqv5qza f1vmzxwi f1o700av f13mvf36 f1cmlufx f9n3di6 f1ids18y f1tx3yz7 f1deo86v f1eh06m1 f1iescvh fhgqx19 f1olyrje f1p93eir f1nev41a f1h8hb77 f1lqvz6u f10aw75t fsle3fq f17ae5zn\" title=\"https:\/\/learn.microsoft.com\/en-us\/semantic-kernel\/support\/v2-openai-migration-guide\" href=\"https:\/\/learn.microsoft.com\/en-us\/semantic-kernel\/support\/v2-openai-migration-guide\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Link OpenAI Connector Migration Guide | Microsoft Learn\">OpenAI Connector Migration Guide | Microsoft Learn<\/a>. <\/span><\/span><\/p>\n<p>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 <a href=\"https:\/\/learn.microsoft.com\/en-us\/nuget\/concepts\/package-versioning?tabs=semver20sort#version-ranges\">NuGet Package Version Reference | Microsoft Learn<\/a>.<\/p>\n<p>In the meantime if there are any urgent changes required in the Semantic Kernel we will include these in patch releases to the current <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.SemanticKernel\/1.17.1\">version 1.17.1 release<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p>If you have any questions please create an issue here <a href=\"https:\/\/github.com\/microsoft\/semantic-kernel\/issues\">Issues \u00b7 microsoft\/semantic-kernel (github.com)<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":131388,"featured_media":2364,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[47,1],"tags":[48,63,9],"class_list":["post-3185","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcement","category-semantic-kernel","tag-ai","tag-microsoft-semantic-kernel","tag-semantic-kernel"],"acf":[],"blog_post_summary":"<p>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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts\/3185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/users\/131388"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/comments?post=3185"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts\/3185\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/media\/2364"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/media?parent=3185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/categories?post=3185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/tags?post=3185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}