Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lsiddiquee/SemanticPluginForge
Dynamic metadata provider for SemanticKernel plugins with real-time updates and extensible architecture
https://github.com/lsiddiquee/SemanticPluginForge
Last synced: 5 days ago
JSON representation
Dynamic metadata provider for SemanticKernel plugins with real-time updates and extensible architecture
- Host: GitHub
- URL: https://github.com/lsiddiquee/SemanticPluginForge
- Owner: lsiddiquee
- License: mit
- Created: 2024-07-16T19:33:29.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-01T10:37:30.000Z (4 months ago)
- Last Synced: 2024-11-14T18:26:17.687Z (29 days ago)
- Language: C#
- Size: 36.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-semantickernel - SemanticPluginForge
README
# SemanticPluginForge
`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.
## Benefits
- **Dynamic Metadata Updates**:
- Make real-time updates to plugin metadata, enhancing flexibility and reducing downtime.
- Implement changes without redeployment, ensuring a seamless update process.- **Extensible Architecture**:
- Implement new metadata providers, such as a database-backed provider, to enable metadata changes without requiring a service restart.
- Support various use cases and future expansions.- **Dynamic Tuning**:
- Fine-tune plugin descriptions and parameters based on evolving requirements or user feedback.
- Quickly respond to changes in business logic or user expectations without interrupting service availability.- **Custom Metadata Providers**:
- Develop custom providers that fetch metadata from different sources, such as databases, remote services, or configuration management systems.
- Achieve higher levels of customization and control over plugin behavior.## 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`.
```csharp
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.
```csharp
services.AddSingleton();
```### Adding Plugins with Patched Metadata
Use the extension methods from this library to add plugins with patched metadata.
```csharp
var kernelBuilder = services.AddKernel();
kernelBuilder.Plugins.AddFromTypeWithMetadata();
```## Contributing
Contributions are welcome! Please open an issue or submit a pull request.
## License
This project is licensed under the MIT License. See the LICENSE file for details.