{"id":1278,"date":"2023-10-04T07:24:02","date_gmt":"2023-10-04T14:24:02","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/semantic-kernel\/?p=1278"},"modified":"2024-01-11T20:44:07","modified_gmt":"2024-01-12T04:44:07","slug":"skills-to-plugins-fully-embracing-the-openai-plugin-spec-in-semantic-kernel","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/agent-framework\/skills-to-plugins-fully-embracing-the-openai-plugin-spec-in-semantic-kernel\/","title":{"rendered":"Skills to plugins: fully embracing the OpenAI plugin spec in Semantic Kernel"},"content":{"rendered":"<h1 style=\"padding-bottom: 2rem;\"><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternlarge.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-89\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternlarge.png\" alt=\"Image skpatternlarge\" width=\"1638\" height=\"136\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternlarge.png 1638w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternlarge-300x25.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternlarge-1024x85.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternlarge-768x64.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternlarge-1536x128.png 1536w\" sizes=\"(max-width: 1638px) 100vw, 1638px\" \/><\/a><\/h2>\n<p>Over the past several weeks, the Semantic Kernel team has been hard at work preparing for the v1.0.0 release at the end of the calendar year. As part of this change, we wanted to complete any remaining breaking changes so developers could have a stable API moving forward. If you are interested in seeing what these changes are, you can preview them using our <a href=\"https:\/\/github.com\/microsoft\/semantic-kernel\/pkgs\/nuget\/Microsoft.SemanticKernel\">nightly builds<\/a>.<\/p>\n<p>We will provide a blog post with all of the significant changes next week when we provide the first release candidate (RC), but before then, we wanted to provide clarity of the biggest change we&#8217;re making: <em>renaming &#8220;skills&#8221; to plugins<\/em>. We&#8217;ve done this so we can better align the internal workings of Semantic Kernel with the plugin specification developed by OpenAI. We believe this will help reduce concept counts and make Semantic Kernel even simpler to use moving forward.<\/p>\n<h2 style=\"clear: both; padding-top: 2rem;\">What are &#8220;plugins&#8221; today?<\/h2>\n<p>Thanks to the spec defined by OpenAI, any developer can take their existing APIs, describe them using both an OpenAPI specification and an ai-plugin.json file so ChatGPT can intelligently perform actions on behalf of a user. A common (and powerful) example is to use the Bing plugin so ChatGPT can answer questions using current information from the world wide web.<\/p>\n<p>Because OpenAI plugins simply describe the behavior of APIs served up on HTTP endpoints, plugin authors can allow their plugins to be used by any other AI service. In the future, this will include Teams Business Chat and Bing Chat. This is powerful because it means you as a developer can write code once and allow your customers to leverage your plugin no matter which agent they use.<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-1280 alignnone aligncenter\" style=\"margin-top: 2rem;\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/10\/aiplugins.png\" alt=\"AI Plugins\" width=\"480\" height=\"221\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/10\/aiplugins.png 965w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/10\/aiplugins-300x139.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/10\/aiplugins-768x355.png 768w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><\/p>\n<h3 style=\"clear: both; padding-top: 1rem;\">Today, you can already import these plugins into Semantic Kernel.<\/h3>\n<p>If you\u2019re building your <em>own<\/em> agent with Semantic Kernel, we also make it easy to import plugins defined with an OpenAI spec so your planners can leverage the functions when auto-generating plans for users. Below is a code sample of how you would previously import an AI plugin.<\/p>\n<pre>\/\/ Add the math plugin using the plugin manifest URL\r\nconst string pluginManifestUrl = \"http:\/\/localhost:7071\/.well-known\/ai-plugin.json\";\r\nvar mathPlugin = await kernel.ImportAIPluginAsync(\"MathPlugin\", new Uri(pluginManifestUrl));<\/pre>\n<h2 style=\"clear: both; padding-top: 2rem;\">\u201cSkills\u201d in Semantic Kernel aren\u2019t that much different&#8230;<\/h2>\n<p>What\u2019s traditionally been called \u201cskills\u201d in Semantic Kernel are like OpenAI plugins. Like plugins, they have the following traits:<\/p>\n<table style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr>\n<td style=\"width: 33.3333%;\"><strong>Similarity<\/strong><\/td>\n<td style=\"width: 33.3333%;\"><strong>Skills<\/strong><\/td>\n<td style=\"width: 33.3333%;\"><strong>Plugins<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">Both have a collection of actions that can be performed by an agent.<\/td>\n<td style=\"width: 33.3333%;\">SKFunctions<\/td>\n<td style=\"width: 33.3333%;\">HTTP endpoints<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">Both semantically describe what the action is, when it should be used, and how to use.<\/td>\n<td style=\"width: 33.3333%;\">SKFunction decorators<\/td>\n<td style=\"width: 33.3333%;\">OpenAPI route specification<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 33.3333%;\">Both can be imported into the kernel so they can be invoked and used in plans.<\/td>\n<td style=\"width: 33.3333%;\">\n<pre>ImportSkill()<\/pre>\n<\/td>\n<td style=\"width: 33.3333%;\">\n<pre>ImportAIPluginAsync()<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"clear: both; padding-top: 1rem;\">The only difference is where they\u2019re run: locally or remotely.<\/h3>\n<p>Whereas OpenAI plugins are remote services that you can call with HTTP requests, \u201cskills\u201d are native or semantic functions that are called by the same process that\u2019s running your kernel.<\/p>\n<p>There are pros and cons to both approaches. By running \u201cskills\u201d in the same process, you can get performance improvements and more easily debug your code if something went wrong. Unfortunately, \u201cskills\u201d are difficult to share with others and cannot be seamlessly imported into agents like ChatGPT, Teams Business Chat, or Bing chat.<\/p>\n<h2 style=\"clear: both; padding-top: 2rem;\">This makes it difficult to choose: build a plugin or a \u201cskill\u201d?<\/h2>\n<p>Because of the subtle differences, developers have a hard choice. Do you build a \u201cskill\u201d to get the efficiency gains? Or spin up a new service that your customers can use in their own AI applications?<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/10\/SkillVsOpenAIPlugin.png\"><img decoding=\"async\" class=\"aligncenter wp-image-1296 size-full\" style=\"margin-top: 1rem; margin-bottom: 1rem;\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/10\/SkillVsOpenAIPlugin.png\" alt=\"Image SkillVsOpenAIPlugin\" width=\"715\" height=\"157\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/10\/SkillVsOpenAIPlugin.png 1430w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/10\/SkillVsOpenAIPlugin-300x66.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/10\/SkillVsOpenAIPlugin-1024x225.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/10\/SkillVsOpenAIPlugin-768x169.png 768w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><\/a>This choice is also hard because it\u2019s not easy today to convert between the two types. Not only would you need to refactor your code to express each SKFunction as an HTTP endpoint, but you\u2019d also need to retest your code with Semantic Kernel because planners today treat \u201cskills\u201d and plugins subtly differently.<\/p>\n<h2 style=\"clear: both; padding-top: 2rem;\">This is changing; \u201cskills\u201d will become plugins.<\/h2>\n<p>Instead of forcing developers like yourself to make a choice, we want to remove the choice all together. In the future, you won\u2019t build \u201cskills\u201d or OpenAI plugins; you\u2019ll just build <em><span style=\"text-decoration: underline;\">plugins<\/span><\/em>.<\/p>\n<p>The future version of \u201cskills\u201d (i.e., plugins) will have the following benefits:<\/p>\n<ul>\n<li>They will be <u>imported the same way<\/u> as OpenAPI plugins.<\/li>\n<li><u>Authentication<\/u> will behave the same as OpenAPI plugins.<\/li>\n<li>They will have all the <u>same metadata<\/u> as OpenAPI plugins.<\/li>\n<li>The <u>planner will treat them the same way<\/u> as OpenAPI plugins.<\/li>\n<li>Exposing them as HTTP endpoints with an OpenAPI spec <u>will be automated<\/u>.<\/li>\n<\/ul>\n<p>With these changes, what few differences exist between \u201cskills\u201d and OpenAI plugins will disappear. They will become functionally identical and the only \u201cchoice\u201d you as a developer will need to make is <em>how<\/em> you share them and consume them.<\/p>\n<h2 style=\"clear: both; padding-top: 2rem;\">To begin this journey, we\u2019re updating our APIs.<\/h2>\n<p>Getting to the point where native and semantic functions are functionally identical to OpenAI plugins will take some time, so the first incremental step we will be taking is updating our APIs for v1.0.0 so that we have a solid foundation moving forward (and no future breaking changes).<\/p>\n<p>This most profoundly changes the import methods for functions added to the kernel. Instead of importing &#8220;skills,&#8221; the import methods will more accurately describe what they do: import &#8220;functions.&#8221;<\/p>\n<table style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr>\n<td style=\"width: 50%;\"><strong>Before<\/strong><\/td>\n<td style=\"width: 50%;\"><strong>After<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">\n<pre>ImportSkill()<\/pre>\n<\/td>\n<td style=\"width: 50%;\">\n<pre>ImportPluginFromType()<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">\n<pre>ImportSemanticSkillFromDirectory()<\/pre>\n<\/td>\n<td style=\"width: 50%;\">\n<pre>ImportPluginFromPromptDirectory()<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">\n<pre>ImportGrpcSkillFromDirectory()<\/pre>\n<\/td>\n<td style=\"width: 50%;\">\n<pre>ImportPluginFromGrpcDirectory()<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 50%;\">\n<pre>ImportAIPluginAsync()<\/pre>\n<\/td>\n<td style=\"width: 50%;\">\n<pre>ImportPluginFromOpenApiAsync()<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>After the functions have been imported, you&#8217;ll then be able to find them in the Functions property of the kernel. For example, to find a function by its name, you will now use the GetFunction() method on the Function property.<\/p>\n<pre class=\"prettyprint language-cs language-csharp\"><code class=\"language-cs language-csharp\">KernelFunction function = kernel.Plugins[\"searchPlugin\"][\"search\"];<\/code><\/pre>\n<h3 style=\"clear: both; padding-top: 1rem;\">Other changes in the SDK.<\/h3>\n<p>In addition to the import method updates, there are a few other changes that have occurred within the SDK that you should be aware of:<\/p>\n<ul>\n<li>Many of the configuration objects (e.g., OpenApiSkillExecutionParameters have been renamed so that &#8220;Skill&#8221; has been replaced with &#8220;Function&#8221;).<\/li>\n<li>Out-of-the-box &#8220;skills&#8221; (e.g., Core Skills, MS Graph Skills, Document Skills, etc.) have been renamed to plugins.<\/li>\n<li><span class=\"ui-provider ea bub bqe cjc cjd cje cjf cjg cjh cji cjj cjk cjl cjm cjn cjo cjp cjq cjr cjs cjt cju cjv cjw cjx cjy cjz cka ckb ckc ckd ckf ckg ckh cki\" dir=\"ltr\">NuGet<\/span> packages with &#8220;skill&#8221; in the name will be deprecated and replaced with versions with &#8220;plugin&#8221; in the name instead.<\/li>\n<\/ul>\n<h2 style=\"clear: both; padding-top: 2rem;\">Keep an eye out for other changes next week.<\/h2>\n<p>Besides updating skills to plugins, we&#8217;re also excited to rip the band aid off for other breaking changes that we believe will improve the usability of the SDK. These include (but are not limited to):<\/p>\n<ul>\n<li>Standardizing the interface for planners.<\/li>\n<li>Support generic LLM request settings.<\/li>\n<li>Make ContextVariables a proper dictionary.<\/li>\n<li>Replace the FunctionsView with a List.<\/li>\n<li>And more!<\/li>\n<\/ul>\n<p>If you have questions about the latest round of changes or need help addressing any breaking changes. Feel free to reach out to us on <a href=\"https:\/\/aka.ms\/sk\/discord\">Discord<\/a> or by <a href=\"https:\/\/github.com\/microsoft\/semantic-kernel\/issues\">creating an issue on GitHub<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Over the past several weeks, the Semantic Kernel team has been hard at work preparing for the v1.0.0 release at the end of the calendar year. As part of this change, we wanted to complete any remaining breaking changes so developers could have a stable API moving forward. If you are interested in seeing what [&hellip;]<\/p>\n","protected":false},"author":121401,"featured_media":1305,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1278","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-semantic-kernel"],"acf":[],"blog_post_summary":"<p>Over the past several weeks, the Semantic Kernel team has been hard at work preparing for the v1.0.0 release at the end of the calendar year. As part of this change, we wanted to complete any remaining breaking changes so developers could have a stable API moving forward. If you are interested in seeing what [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts\/1278","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\/121401"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/comments?post=1278"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts\/1278\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/media\/1305"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/media?parent=1278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/categories?post=1278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/tags?post=1278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}