AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Interface
1.0.0
dotnet add package AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Interface --version 1.0.0
NuGet\Install-Package AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Interface -Version 1.0.0
<PackageReference Include="AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Interface" Version="1.0.0" />
paket add AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Interface --version 1.0.0
#r "nuget: AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Interface, 1.0.0"
// Install AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Interface as a Cake Addin #addin nuget:?package=AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Interface&version=1.0.0 // Install AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Interface as a Cake Tool #tool nuget:?package=AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Interface&version=1.0.0
AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Interface
The AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Interface
The core of the semantic kernel plugin does not currently accommodate interface-based plugin types. However, this limitation is resolved within the included package
and concentrate exclusively on an interface rather than a specific class when dealing with the KernelFunction
and its corresponding Description
.
An example scenario for utilizing this plugin is synchronizing with existing classes without modifying them, or selectively importing specific functions into the plugins using the interface plugins.
Building a Microsoft Semantic Kernel PlugIn Interface
In this guide, we will walk you through the process of Microsoft Semantic Kernel PlugIn Interface.
Prerequisites
Install AzureAI.Community.Microsoft.Semantic.Kernel.PlugIn.Interface from nuget server
The interface plugin into the kernel.
Simply invoke ImportPluginFromInterface
with the necessary built-in key during the kernel building process.
kernelBuilder.ImportPluginFromInterface<Interface>(class object);
Concentrate exclusively on an interface rather than a specific class when dealing with the KernelFunction
and its corresponding Description
Here's an example code snippet:
[Description("This interface contains simple maths functions")]
public interface IMathsPlugin
{
[KernelFunction, Description("Add two numbers")]
double Add(
[Description("The first number to add")] double number1,
[Description("The second number to add")] double number2
);
[KernelFunction, Description("Subtract two numbers")]
double Subtract(
[Description("The first number to subtract from")] double number1,
[Description("The second number to subtract away")] double number2
);
}
The interface has been implemented in a class.
public class Maths : IMathsPlugin
{
public double Add(double number1, double number2)
{
return number1 + number2;
}
public double Subtract(double number1, double number2)
{
return number1 - number2;
}
}
Incorporate the interface plugin into the kernel.
kernelBuilder.ImportPluginFromInterface<IMathsPlugin>(new Maths());
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.SemanticKernel (>= 1.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 604 | 1/21/2024 |