KernelExtensions.CreatePluginFromType Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CreatePluginFromType<T>(Kernel, String) |
Creates a plugin that wraps a new instance of the specified type |
CreatePluginFromType<T>(Kernel, JsonSerializerOptions, String) |
Creates a plugin that wraps a new instance of the specified type |
CreatePluginFromType<T>(Kernel, String)
Creates a plugin that wraps a new instance of the specified type T
.
public static Microsoft.SemanticKernel.KernelPlugin CreatePluginFromType<T>(this Microsoft.SemanticKernel.Kernel kernel, string? pluginName = default);
static member CreatePluginFromType : Microsoft.SemanticKernel.Kernel * string -> Microsoft.SemanticKernel.KernelPlugin
<Extension()>
Public Function CreatePluginFromType(Of T) (kernel As Kernel, Optional pluginName As String = Nothing) As KernelPlugin
Type Parameters
- T
Specifies the type of the object to wrap.
Parameters
- kernel
- Kernel
The Kernel containing services, plugins, and other state for use throughout the operation.
- pluginName
- String
Name of the plugin for function collection and prompt templates. If the value is null, a plugin name is derived from the type of the T
.
Returns
A KernelPlugin containing KernelFunctions for all relevant members of T
.
Remarks
Methods that have the KernelFunctionAttribute attribute will be included in the plugin. See KernelFunctionAttribute attribute for details.
Applies to
CreatePluginFromType<T>(Kernel, JsonSerializerOptions, String)
Creates a plugin that wraps a new instance of the specified type T
.
public static Microsoft.SemanticKernel.KernelPlugin CreatePluginFromType<T>(this Microsoft.SemanticKernel.Kernel kernel, System.Text.Json.JsonSerializerOptions jsonSerializerOptions, string? pluginName = default);
static member CreatePluginFromType : Microsoft.SemanticKernel.Kernel * System.Text.Json.JsonSerializerOptions * string -> Microsoft.SemanticKernel.KernelPlugin
<Extension()>
Public Function CreatePluginFromType(Of T) (kernel As Kernel, jsonSerializerOptions As JsonSerializerOptions, Optional pluginName As String = Nothing) As KernelPlugin
Type Parameters
- T
Specifies the type of the object to wrap.
Parameters
- kernel
- Kernel
The Kernel containing services, plugins, and other state for use throughout the operation.
- jsonSerializerOptions
- JsonSerializerOptions
The JsonSerializerOptions to use for serialization and deserialization of various aspects of the function.
- pluginName
- String
Name of the plugin for function collection and prompt templates. If the value is null, a plugin name is derived from the type of the T
.
Returns
A KernelPlugin containing KernelFunctions for all relevant members of T
.
Remarks
Methods that have the KernelFunctionAttribute attribute will be included in the plugin. See KernelFunctionAttribute attribute for details.