microsoft / microsoft/semantic-kernel
.Net: New Feature: Support adding Plugin-Description when creating plugin from apimanifest
@SergeyMenshykh is already working on this.
Since Apr 15, 2025.
- Dominant language
- C#
- Stars
- 28.6k
- Forks
- 4.8k
- Avg merge
- 14h 13m
- Merged PRs (30d)
- 18
Description
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:
- extract the description from the apimanifest file
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.