Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
AleRoe opened this issue Apr 15, 2025 · 4 comments
Assignees
Labels
.NET Issue or Pull requests regarding .NET code openapi Issues related to the OpenAPI function importer

Comments

@AleRoe
Copy link
Contributor

AleRoe commented Apr 15, 2025


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

@markwallace-microsoft markwallace-microsoft added triage .NET Issue or Pull requests regarding .NET code openapi Issues related to the OpenAPI function importer labels Apr 15, 2025
@github-actions github-actions bot changed the title New Feature: Support adding Plugin-Description when creating plugin from apimanifest .Net: New Feature: Support adding Plugin-Description when creating plugin from apimanifest Apr 15, 2025
@markwallace-microsoft markwallace-microsoft moved this to Backlog: Planned in Semantic Kernel Apr 15, 2025
@markwallace-microsoft
Copy link
Member

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

@AleRoe
Copy link
Contributor Author

AleRoe commented Apr 15, 2025

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
Copy link
Contributor Author

AleRoe commented Apr 16, 2025

I've added a request in the Microsoft.OpenApi.Apimanifest project to add a description field.
microsoft/OpenApi.ApiManifest#156

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

@AleRoe
Copy link
Contributor Author

AleRoe commented Apr 23, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.NET Issue or Pull requests regarding .NET code openapi Issues related to the OpenAPI function importer
Projects
Status: Backlog: Planned
Development

No branches or pull requests

3 participants