Share via


KernelPlugin Class

  • java.lang.Object
    • com.microsoft.semantickernel.plugin.KernelPlugin

Implements

java.lang.Iterable<KernelFunction<?>>

public class KernelPlugin
implements java.lang.Iterable<KernelFunction<?>>

A plugin contains a collection of functions that can be invoked by the Semantic Kernel.

Constructor Summary

Constructor Description
KernelPlugin(String name, String description, Map<String,KernelFunction<?>> plugins)

Creates a new instance of the KernelPlugin class.

Method Summary

Modifier and Type Method and Description
KernelFunction<T> get(String functionName)

Gets a function by name.

void addFunction(KernelFunction<?> function)

Adds a function to the plugin.

java.lang.String getDescription()

Gets the description of the plugin.

java.util.Map<java.lang.String,KernelFunction<?>> getFunctions()

Gets the functions in the plugin.

java.lang.String getName()

Gets the name of the plugin.

java.util.Iterator<KernelFunction<?>> iterator()

Get an Iterator that iterates over the functions of this plugin.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

KernelPlugin

public KernelPlugin(String name, String description, Map> plugins)

Creates a new instance of the KernelPlugin class.

Parameters:

name - The name of the plugin.
description - The description of the plugin.
plugins - The functions in the plugin.

Method Details

get

public KernelFunction get(String functionName)

Gets a function by name.

Parameters:

functionName - The name of the function.

Returns:

The function with the specified name, or null if no such function exists.

addFunction

public void addFunction(KernelFunction function)

Adds a function to the plugin.

Parameters:

function - The function to add.

getDescription

public String getDescription()

Gets the description of the plugin.

Returns:

The description of the plugin.

getFunctions

public Map> getFunctions()

Gets the functions in the plugin.

Returns:

The functions in the plugin.

getName

public String getName()

Gets the name of the plugin.

Returns:

The name of the plugin.

iterator

public Iterator> iterator()

Get an Iterator that iterates over the functions of this plugin.

Returns:

An Iterator that iterates over the functions of this plugin.

Applies to