SemanticPluginForge

Dynamically enhance your Semantic Kernel plugins with powerful metadata capabilities

SemanticPluginForge adds functionality to dynamically alter the metadata for SemanticKernel plugins. This library introduces the IPluginMetadataProvider interface, allowing for real-time updates to plugin metadata, including descriptions, return value descriptions, and parameter descriptions, without the need for redeployment.

๐Ÿš€ Key Features

๐Ÿ“ฆ Quick Installation

dotnet add package SemanticPluginForge.Core

๐ŸŽฏ Quick Start

1. Create a Metadata Provider

public class CustomMetadataProvider : IPluginMetadataProvider
{
    public PluginMetadata? GetPluginMetadata(KernelPlugin plugin) =>
        plugin.Name == "TimePlugin" ? new PluginMetadata
        {
            Description = "Enhanced time and date operations"
        } : 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 format" 
            }
            : null;
}

2. Register and Use

// Register the metadata provider
services.AddSingleton<IPluginMetadataProvider, CustomMetadataProvider>();

// Add plugins with enhanced metadata
var kernelBuilder = services.AddKernel();
kernelBuilder.Plugins.AddFromTypeWithMetadata<TimePlugin>();

๐Ÿ“š Documentation

Section Description
๐ŸŽฏ Getting Started Step-by-step setup and basic usage
๐Ÿง  Core Concepts Understand the fundamentals
โšก Advanced Features Suppression, CLR types, and more
๐Ÿ“– Samples Practical examples and tutorials
๐Ÿ“‹ API Reference Complete API documentation

๐ŸŽช Live Examples

Suppress Parameters with Smart Defaults

public FunctionMetadata? GetFunctionMetadata(KernelPlugin plugin, KernelFunctionMetadata metadata)
{
    if (plugin.Name == "WeatherPlugin" && metadata.Name == "GetWeather")
    {
        return new FunctionMetadata(metadata.Name)
        {
            Description = "Gets weather for user's location (auto-detected)",
            Parameters = new List<ParameterMetadata>
            {
                new ParameterMetadata("location") 
                { 
                    Suppress = true, 
                    DefaultValue = "user_current_location"
                }
            }
        };
    }
    return null;
}

Use Any Class as a Plugin

public class MathUtils
{
    public double Add(double a, double b) => a + b;
    public double Multiply(double a, double b) => a * b;
}

// No attributes needed!
kernelBuilder.Plugins.AddFromClrTypeWithMetadata<MathUtils>("MathPlugin");

Override Function Names

return new FunctionMetadata(metadata.Name)
{
    OverrideFunctionName = "CalculateSum", // Better name for AI
    Description = "Adds two numbers together"
};

๐Ÿ† Benefits

For Developers

For Operations

For AI Applications

๐ŸŽฏ Sample Projects

Explore our comprehensive samples:

Sample Focus Key Learning
DefaultValue Parameter handling Smart defaults and suppression
UseClrType Legacy integration CLR types as plugins
AzureAiSearchPlugin Production patterns Multiple instances, different configs

๐Ÿš€ Getting Started

Ready to enhance your Semantic Kernel plugins?

  1. ๐Ÿ“– Read the Introduction - Understand what SemanticPluginForge can do
  2. ๐ŸŽฏ Follow Getting Started - Get up and running in minutes
  3. ๐Ÿงช Try the Samples - Explore practical examples
  4. โšก Explore Advanced Features - Unlock the full potential

๐Ÿค Contributing

Contributions are welcome! Please open an issue or submit a pull request.