Partager via


KernelExtensions.ImportPluginFromObject(Kernel, Object, String) Method

Definition

Creates a plugin that wraps the specified target object and imports it into the kernel's plugin collection.

public static Microsoft.SemanticKernel.KernelPlugin ImportPluginFromObject (this Microsoft.SemanticKernel.Kernel kernel, object target, string? pluginName = default);
static member ImportPluginFromObject : Microsoft.SemanticKernel.Kernel * obj * string -> Microsoft.SemanticKernel.KernelPlugin
<Extension()>
Public Function ImportPluginFromObject (kernel As Kernel, target As Object, Optional pluginName As String = Nothing) As KernelPlugin

Parameters

kernel
Kernel

The Kernel containing services, plugins, and other state for use throughout the operation.

target
Object

The instance of the class to be wrapped.

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 target.

Returns

A KernelPlugin containing KernelFunctions for all relevant members of target.

Remarks

Methods that have the KernelFunctionAttribute attribute will be included in the plugin. See KernelFunctionAttribute attribute for details.

Applies to