Class KernelPlugin
- java.lang.Object
-
- com.microsoft.semantickernel.plugin.KernelPlugin
-
- All Implemented Interfaces:
Iterable<KernelFunction<?>>
public class KernelPlugin extends Object implements Iterable<KernelFunction<?>>
A plugin contains a collection of functions that can be invoked by the Semantic Kernel.
-
-
Constructor Summary
Constructors Constructor Description KernelPlugin(String name, String description, Map<String,KernelFunction<?>> plugins)Creates a new instance of theKernelPluginclass.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFunction(KernelFunction<?> function)Adds a function to the plugin.<T> KernelFunction<T>get(String functionName)Gets a function by name.StringgetDescription()Gets the description of the plugin.Map<String,KernelFunction<?>>getFunctions()Gets the functions in the plugin.StringgetName()Gets the name of the plugin.Iterator<KernelFunction<?>>iterator()Get anIteratorthat iterates over the functions of this plugin.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
KernelPlugin
public KernelPlugin(String name, @Nullable String description, Map<String,KernelFunction<?>> plugins)
Creates a new instance of theKernelPluginclass.- Parameters:
name- The name of the plugin.description- The description of the plugin.plugins- The functions in the plugin.
-
-
Method Detail
-
addFunction
public void addFunction(KernelFunction<?> function)
Adds a function to the plugin.- Parameters:
function- The function to add.
-
getFunctions
public Map<String,KernelFunction<?>> getFunctions()
Gets the functions in the plugin.- Returns:
- The functions in the plugin.
-
get
@Nullable public <T> KernelFunction<T> get(String functionName)
Gets a function by name.- Type Parameters:
T- The return type of the function.- Parameters:
functionName- The name of the function.- Returns:
- The function with the specified name, or
nullif no such function exists.
-
iterator
public Iterator<KernelFunction<?>> iterator()
Get anIteratorthat iterates over the functions of this plugin.- Specified by:
iteratorin interfaceIterable<KernelFunction<?>>- Returns:
- An
Iteratorthat iterates over the functions of this plugin.
-
getName
public String getName()
Gets the name of the plugin.- Returns:
- The name of the plugin.
-
-