Use the out-of-the-box plugins in the kernel
To provide a degree of standardization across Semantic Kernel implementations, the GitHub repo has several plugins available out-of-the-box depending on the language you are using. These plugins are often referred to as Core plugins. Additionally, each library also includes a handful of other plugins that you can use. The following section covers each set of plugins in more detail.
Core plugins
The core plugins are planned to be available in all languages since they are core to using Semantic Kernel. Below are the core plugins currently available in Semantic Kernel along with their current support for each language. The ❌ symbol indicates that the feature is not yet available in that language; if you would like to see a feature implemented in a language, please consider contributing to the project or opening an issue.
Plugin | Description | C# | Python | Java |
---|---|---|---|---|
ConversationSummaryPlugin |
To summarize a conversation | ✅ | ✅ | * |
FileIOPlugin |
To read and write to the filesystem | ✅ | ✅ | ❌ |
HttpPlugin |
To call APIs | ✅ | ✅ | ❌ |
MathPlugin |
To perform mathematical operations | ✅ | ✅ | ❌ |
TextMemoryPlugin |
To store and retrieve text in memory | ✅ | ✅ | ❌ |
TextPlugin |
To deterministically manipulating text strings | ✅ | ✅ | * |
TimePlugin |
To acquire the time of day and any other temporal information | ✅ | ✅ | * |
WaitPlugin |
To pause execution for a specified amount of time | ✅ | ✅ | ❌ |
You can find the full list of core plugins for each language by following the links below:
Using core plugins in Semantic Kernel
If you want to use one of the core plugins, you can easily import them into your project. For example, if you want to use the TimePlugin
in C#, Java or Python, you can import it as follows.
When using a core plugin, be sure to install the Microsoft.SemanticKernel.Plugins.Core nuget package, and include a using Microsoft.SemanticKernel.Plugins.Core
:
using Microsoft.SemanticKernel.Plugins.Core;
// Instantiate a kernelBuilder and configure it
kernelBuilder.Plugins.AddFromType<TimePlugin>();
var kernel = kernelBuilder.Build();
const string promptTemplate = @"
Today is: {{time.Date}}
Current time is: {{time.Time}}
Answer to the following questions using JSON syntax, including the data used.
Is it morning, afternoon, evening, or night (morning/afternoon/evening/night)?
Is it weekend time (weekend/not weekend)?";
var results = await kernel.InvokePromptAsync(promptTemplate);
Console.WriteLine(results);
The output should be similar to the following:
{
"date": "Wednesday, 21 June, 2023",
"time": "12:17:02 AM",
"period": "night",
"weekend": "not weekend"
}