docs/decisions/0039-set-plugin-name-in-metadata.md
The KernelFunctionMetadata.PluginName property is populated as a side-effect of calling KernelPlugin.GetFunctionsMetadata.
The reason for this behavior is to allow a KernelFunction instance to be associated with multiple KernelPlugin instances.
The downside of this behavior is the KernelFunctionMetadata.PluginName property is not available to IFunctionFilter callbacks.
The purpose of this ADR is to propose a change that will allow developers to decide when KernelFunctionMetadata.PluginName will be populated.
Issues:
KernelFunctionMetadata.PluginName property available to IFunctionFilter callbacks.KernelFunction when it is added to a KernelPlugin and set the plugin name in the clone KernelFunctionMetadata.KernelPluginFactory.CreateFromFunctions to enable setting the plugin name in the associated KernelFunctionMetadata instances. Once set the KernelFunctionMetadata.PluginName cannot be changed. Attempting to do so will result in an InvalidOperationException being thrown.Chosen option: Clone each KernelFunction, because result is a consistent behavior and allows the same function can be added to multiple KernelPlugin's.
KernelFunctionPR: https://github.com/microsoft/semantic-kernel/pull/5422
KernelPlugin's.KernelFunction instances are created.KernelPluginFactory.CreateFromFunctionsPR: https://github.com/microsoft/semantic-kernel/pull/5171
KernelFunction instances are created.KernelPlugin'sKernelPlugin is created it will behave differently.