Author Likhan Siddiquee details how SemanticPluginForge offers developers dynamic and flexible metadata management for plugins in the Semantic Kernel ecosystem. The post explains traditional metadata challenges and provides practical steps for integrating the tool into modern .NET development workflows.

Enhancing Plugin Metadata Management with SemanticPluginForge

Author: Likhan Siddiquee

In the world of software development, flexibility and adaptability are key. Developers often face challenges when it comes to updating plugin metadata dynamically without disrupting services or requiring redeployment. This is where SemanticPluginForge, an open-source project, steps in to improve the way we manage plugin metadata.

LLM Function Calling Feature

Function calling capabilities within Large Language Models (LLMs) let developers specify a set of functions that can be invoked in conversational scenarios. These functions are described using metadata—including names, parameters, and descriptions—enabling the LLM to determine usage patterns and integration points with external systems.

Semantic Kernel Plugins and Function Calling

Semantic Kernel plugins further enhance the LLM function-calling experience by structuring the definition and management of these functions. Each plugin bundles related functionalities and exposes them via comprehensive metadata: descriptions, parameter details, and return value information. This setup benefits both developers and AI-powered agents by promoting clarity and utilization.

SemanticPluginForge builds on this foundation to provide tools for dynamically managing and updating plugin metadata, keeping function calling flexible, adaptable, and user-friendly.

The Pain Points in Traditional Plugin Metadata Management

1. Static Metadata Management

  • Downtime for Updates: Updates require redeployment, interrupting service.
  • Limited Customization: Adapting to new business needs or feedback is cumbersome.
  • Rigid Architecture: Not well suited to future expansion or dynamic scenarios.

2. Inconsistent User Experience

  • Outdated or inaccurate metadata can confuse users and hinder plugin effectiveness.

3. Complex Maintenance

  • Handling metadata across many plugins demands significant maintenance effort, especially in large systems.

4. Challenges with OpenAPI Specifications

  • Lack of Control: Developers may not control API specs and thus cannot update descriptions for LLMs.
  • Change Management Overhead: Even with control, updates could require formal change processes.
  • Balancing Human and LLM Needs: Writing metadata suitable for both users and LLMs is non-trivial.
  • Local Copy Maintenance: Keeping local copies of specs can create redundancy and conflicts.

5. Wrapper Classes for SDKs

  • Integrating third-party classes (e.g., from SDKs) often requires custom wrappers and attribute decoration—adding unnecessary overhead.

Enter SemanticPluginForge

SemanticPluginForge solves these challenges through a dynamic, extensible approach to plugin metadata management:

1. Dynamic Metadata Updates

  • Real-time updates to plugin metadata without application redeployment.
  • Zero downtime and easier adaptation to changing requirements or user feedback.

2. Extensible Architecture

  • Provides an IPluginMetadataProvider interface, allowing custom metadata provider implementations.
    • Fetch metadata from a database or external source.
    • Tailor metadata based on business logic.

3. Suppressing Functions and Parameters

  • Option to conditionally suppress (hide) specific functions or parameters in the plugin metadata.
    • Useful for hiding sensitive or irrelevant details while maintaining functionality.

4. Improved User Experience

  • Ensures that users always encounter current, relevant metadata, improving usability.

5. Simplified Maintenance

  • Centralized, dynamic management simplifies maintaining consistency across many plugins.

6. Future-Proof Design

  • Modular and scalable for large systems and integration with new technologies.

7. Simplified SDK and Class Integration

  • Use any class or object directly (no wrappers or attributes needed), as long as you supply suitable metadata. This eases integration and streamlines agent functionality.

How to Get Started with SemanticPluginForge

Follow these steps to integrate SemanticPluginForge in your .NET project:

1. Install the NuGet Package

dotnet add package SemanticPluginForge.Core

2. Implement a Custom Metadata Provider

Create your provider by implementing the IPluginMetadataProvider interface.

public class SampleMetadataProvider : IPluginMetadataProvider
{
    public FunctionMetadata? GetFunctionMetadata(KernelPlugin plugin, KernelFunctionMetadata metadata)
        => plugin.Name switch
        {
            "WeatherPlugin" => metadata.Name == "GetTemperatureByCity"
                ? new FunctionMetadata(metadata.Name)
                {
                    Description = metadata.Description,
                    Parameters = [
                        new ParameterMetadata("name")
                        {
                            Description = "The name of the city should be retrieved from the user context, if not in context, please ask the user.",
                            IsRequired = true,
                        },
                        new ParameterMetadata("unit")
                        {
                            Description = "This description does not matter as this will always be suppressed and the default will be used.",
                            IsRequired = false,
                            Suppress = true,
                            DefaultValue = "celsius",
                        }
                    ],
                    ReturnParameter = new ReturnParameterMetadata
                    {
                        Description = "The temperature of the city in the specified unit."
                    },
                }
                : null,
            "ShortDatePlugin" => metadata.Name == "ToShortDateString"
                ? new FunctionMetadata(metadata.Name)
                {
                    Description = "Returns the date in short format."
                }
                : null,
            _ => null,
        };

    public PluginMetadata? GetPluginMetadata(KernelPlugin plugin)
        => plugin.Name switch
        {
            "WeatherPlugin" => new PluginMetadata
            {
                Description = "This plugin can be used to retrieve information about the weather."
            },
            "ShortDatePlugin" => new PluginMetadata
            {
                Description = "This plugin returns date and time information."
            },
            _ => null
        };
}

3. Register Your Metadata Provider

services.AddSingleton<IPluginMetadataProvider, CustomMetadataProvider>();

4. Add Plugins with Patched Metadata

kernel.Plugins.AddFromTypeWithMetadata<WeatherServicePlugin>("WeatherService");

5. Add Types Without KernelFunction Attributes

kernelBuilder.Plugins.AddFromClrObjectWithMetadata(new DateTime(), "ShortDatePlugin");

For complete code samples and advanced guidance, see the project README.

Join the Community

SemanticPluginForge is open source and welcomes contributions—bug reports, feature suggestions, or pull requests. Connect via the GitHub repository to get involved.

Conclusion

SemanticPluginForge lets developers move beyond the limitations of static, hardcoded plugin metadata by offering a dynamic, extensible, and maintainable solution. Adopting this library can greatly enhance the flexibility and effectiveness of plugins in your Semantic Kernel or LLM-driven applications.

Ready to improve your plugin metadata management? Explore SemanticPluginForge for a more agile development workflow.

This post appeared first on “Microsoft DevBlog”. Read the entire article here