semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

.Net: New Feature: Support adding Plugin-Description when creating plugin from apimanifest

Open AleRoe opened this issue 8 months ago • 4 comments


name: Feature request about: Suggest an idea for this project


When creating a new plugin using either the CreatePluginFromApiManifestAsync or ImportPluginFromApiManifestAsync, from the Microsoft.SemanticKernel.Plugins.OpenApi.Extensions package, there's no way to set the Description property of the KernelPlugin (which is readonly). The description property is needed though to give SK the needed context as to what the plugin does.

There are two options:

  1. extract the description from the apimanifest file
  2. provide overloads for the extension methods to pass the description

Option 1) This would be the ideal solution. But currently, the Microsoft.OpenApi.ApiManifest.ApiManifestDocument class does not support a Description value and would have to be extended. I'm not sure if the official spec actually intends to support that or not, but I have seen Microsoft samples that do include a description value.

Option 2) Add an optional parameter to the method:

/// <summary>
/// Creates a kernel plugin from an API manifest file asynchronously.
/// </summary>
/// <param name="kernel">The kernel instance.</param>
/// <param name="pluginName">The name of the plugin.</param>
/// <param name="filePath">The file path of the API manifest.</param>
/// <param name="description">The derscription of the plugin.</param>
/// <param name="pluginParameters">Optional parameters for the plugin setup.</param>
/// <param name="cancellationToken">Optional cancellation token.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the created kernel plugin.</returns>
public static async Task<KernelPlugin> CreatePluginFromApiManifestAsync(
    this Kernel kernel,
    string pluginName,
    string filePath,
    string? description = null,
    ApiManifestPluginParameters? pluginParameters = null,
    CancellationToken cancellationToken = default)

and then add the value when creating the KernelPlugin: return KernelPluginFactory.CreateFromFunctions(pluginName, description, functions);

(Same would apply to ImportPluginFromApiManifestAsync)

Option 2) is really a very easy fix and I would really appreciate if that could be added.

Thanks Alexander

AleRoe avatar Apr 15 '25 02:04 AleRoe

Hi @AleRoe, I agree option 1 would be the preferred solution. Is this something you could contribute to the Semantic Kernel?

markwallace-microsoft avatar Apr 15 '25 13:04 markwallace-microsoft

Hi @markwallace-microsoft, I'm more than happy to contribute! Can you confirm that Microsoft.OpenApi.ApiManifest.ApiManifestDocument is intended to support a Description property?

AleRoe avatar Apr 15 '25 14:04 AleRoe

I've added a request in the Microsoft.OpenApi.Apimanifest project to add a description field. https://github.com/microsoft/OpenApi.ApiManifest/issues/156

In the meantime we could still implement option2)...

AleRoe avatar Apr 16 '25 08:04 AleRoe

Update: Option 2) has been implemented with Release 1.47. I will leave this issue open as implmenting Option 1) is still open depending on support from microsoft/openapi/apimanifest

AleRoe avatar Apr 23 '25 08:04 AleRoe

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar Jul 23 '25 02:07 github-actions[bot]