SemanticPluginForge.OpenAI
1.0.1-alpha
This is a prerelease version of SemanticPluginForge.OpenAI.
dotnet add package SemanticPluginForge.OpenAI --version 1.0.1-alpha
NuGet\Install-Package SemanticPluginForge.OpenAI -Version 1.0.1-alpha
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SemanticPluginForge.OpenAI" Version="1.0.1-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SemanticPluginForge.OpenAI --version 1.0.1-alpha
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SemanticPluginForge.OpenAI, 1.0.1-alpha"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SemanticPluginForge.OpenAI as a Cake Addin #addin nuget:?package=SemanticPluginForge.OpenAI&version=1.0.1-alpha&prerelease // Install SemanticPluginForge.OpenAI as a Cake Tool #tool nuget:?package=SemanticPluginForge.OpenAI&version=1.0.1-alpha&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SemanticPluginForge
SemanticPluginForge is a .NET library for extending Semantic Kernel plugins with metadata support.
Installation
You can install the SemanticPluginForge package via NuGet:
dotnet add package SemanticPluginForge
Usage
Implementing a Custom Metadata Provider
Implement the IPluginMetadataProvider
interface. The following code is a sample provider that overrides the description of a function from the TimePlugin
.
public class CustomTimeYearMetadataProvider : IPluginMetadataProvider
{
public PluginMetadata? GetPluginMetadata(KernelPlugin plugin) => null;
public FunctionMetadata GetFunctionMetadata(KernelPlugin plugin, KernelFunctionMetadata metadata) =>
plugin.Name == "TimePlugin" && metadata.Name == "Year"
? new FunctionMetadata(metadata.Name) { Description = "Get the current year in 4-digit number format." }
: null;
}
Registering the Metadata Provider
Register the custom metadata provider with the service collection.
services.AddSingleton<IPluginMetadataProvider, CustomTimeYearMetadataProvider>();
Adding Plugins with Patched Metadata
Use the extension methods from this library to add plugins with patched metadata.
var kernelBuilder = services.AddKernel();
var kernel = kernelBuilder.Build();
kernel.AddFromOpenApiWithMetadataAsync("SamplePlugin", "sample_open_api_spec.json");
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.SemanticKernel.Plugins.OpenApi.Extensions (>= 1.15.0-alpha)
- SemanticPluginForge.Core (>= 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.1-alpha | 47 | 8/1/2024 |
1.0.0-alpha | 67 | 7/23/2024 |