KernelPluginFactory Class
- java.
lang. Object - com.
microsoft. semantickernel. plugin. KernelPluginFactory
- com.
public class KernelPluginFactory
Factory for creating KernelPlugin instances. KernelPlugins can be created from a Java object, from loading a directory of plugins, or from loading plugins from a resource.
Constructor Summary
| Constructor | Description | |
|---|---|---|
| KernelPluginFactory() | ||
Method Summary
Methods inherited from java.lang.Object
Constructor Details
KernelPluginFactory
public KernelPluginFactory()
Method Details
createFromFunctions
public static KernelPlugin createFromFunctions(String pluginName, String description, List
Initializes the new plugin from the provided name, description, and function collection.
Parameters:
Returns:
createFromFunctions
public static KernelPlugin createFromFunctions(String pluginName, List
Creates a plugin from the provided name and function collection.
Parameters:
Returns:
createFromObject
public static KernelPlugin createFromObject(Class clazz, Object target, String pluginName)
Creates a plugin that wraps the specified target object. Methods decorated with {@literal @}DefineSKFunction will be included in the plugin.
Parameters:
null, a plugin name is derived from the type of the
target.
Returns:
createFromObject
public static KernelPlugin createFromObject(Object target, String pluginName)
Creates a plugin that wraps the specified target object. Methods decorated with {@literal @}DefineSKFunction will be included in the plugin.
Parameters:
null, a plugin name is derived from the type of the
target.
Returns:
getTypeForName
public static Class getTypeForName(String className)
Returns the class for the provided type name.
Parameters:
Returns:
importPluginFromDirectory
public static KernelPlugin importPluginFromDirectory(Path parentDirectory, String pluginDirectoryName, PromptTemplateFactory promptTemplateFactory)
Imports a plugin from a directory. The directory should contain subdirectories, each of which contains a prompt template and a configuration file. The configuration file should be named "config.json" and the prompt template should be named "skprompt.txt".
Parameters:
Returns:
importPluginFromResourcesDirectory
public static KernelPlugin importPluginFromResourcesDirectory(String parentDirectory, String pluginDirectoryName, String functionName, PromptTemplateFactory promptTemplateFactory)
Imports a plugin from a resource directory on the filesystem.
Parameters:
Returns:
importPluginFromResourcesDirectory
public static KernelPlugin importPluginFromResourcesDirectory(String parentDirectory, String pluginDirectoryName, String functionName, PromptTemplateFactory promptTemplateFactory, Class clazz)
Imports a plugin from a resource directory, which may be on the classpath or filesystem. The directory should contain subdirectories, each of which contains a prompt template and a configuration file. The configuration file should be named "config.json" and the prompt template should be named "skprompt.txt".
Parameters:
Returns: