KernelPluginFactory.CreateFromObject 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
CreateFromObject(Object, String, ILoggerFactory) |
Creates a plugin that wraps the specified target object. |
CreateFromObject<T>(T, JsonSerializerOptions, String, ILoggerFactory) |
Creates a plugin that wraps the specified target object. |
CreateFromObject(Object, String, ILoggerFactory)
Creates a plugin that wraps the specified target object.
public static Microsoft.SemanticKernel.KernelPlugin CreateFromObject(object target, string? pluginName = default, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default);
static member CreateFromObject : obj * string * Microsoft.Extensions.Logging.ILoggerFactory -> Microsoft.SemanticKernel.KernelPlugin
Public Shared Function CreateFromObject (target As Object, Optional pluginName As String = Nothing, Optional loggerFactory As ILoggerFactory = Nothing) As KernelPlugin
Parameters
- 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
.
- loggerFactory
- ILoggerFactory
The ILoggerFactory to use for logging. If null, no logging will be performed.
Returns
A KernelPlugin containing KernelFunctions for all relevant members of target
.
Remarks
Methods decorated with KernelFunctionAttribute will be included in the plugin. Attributed methods must all have different names; overloads are not supported.
Applies to
CreateFromObject<T>(T, JsonSerializerOptions, String, ILoggerFactory)
Creates a plugin that wraps the specified target object.
public static Microsoft.SemanticKernel.KernelPlugin CreateFromObject<T>(T target, System.Text.Json.JsonSerializerOptions jsonSerializerOptions, string? pluginName = default, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default);
static member CreateFromObject : 'T * System.Text.Json.JsonSerializerOptions * string * Microsoft.Extensions.Logging.ILoggerFactory -> Microsoft.SemanticKernel.KernelPlugin
Public Shared Function CreateFromObject(Of T) (target As T, jsonSerializerOptions As JsonSerializerOptions, Optional pluginName As String = Nothing, Optional loggerFactory As ILoggerFactory = Nothing) As KernelPlugin
Type Parameters
- T
Parameters
- target
- T
The instance of the class to be wrapped.
- 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 target
.
- loggerFactory
- ILoggerFactory
The ILoggerFactory to use for logging. If null, no logging will be performed.
Returns
A KernelPlugin containing KernelFunctions for all relevant members of target
.
Remarks
Methods decorated with KernelFunctionAttribute will be included in the plugin. Attributed methods must all have different names; overloads are not supported.