-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.Net: Change IKernelPlugin to be abstract class KernelPlugin #4084
.Net: Change IKernelPlugin to be abstract class KernelPlugin #4084
Conversation
What's the reason for this change? If we want to convert IKernelPlugin to be a base class instead, I'd suggest a few changes:
|
Actually, the current KernelPlugin (the mutable one) probably doesn't even need to be public. You just have a KernelPluginFactory method that takes a name and an |
|
I like this for the additional reason that it means b someone can't downcast to the mutable type and start adding functions to some random plugin. |
For tooling scenarios we want to allow a developer to add functions to the Plugin. This is what Diego does in his .Net Interactive tool. So if we don't make the implementation that allows this public, do we add extension methods for |
I see. Add functions one by one? In that case, yes, someone would need a mutable implementation, though it doesn't necessarily need to be in the core. With most of the functionality in the base class, someone who needs that interactivity could write the class which would be pretty short, right? |
dotnet/src/SemanticKernel.Abstractions/Functions/ReadOnlyKernelPlugin.cs
Outdated
Show resolved
Hide resolved
dotnet/src/SemanticKernel.Abstractions/Functions/ReadOnlyKernelPlugin.cs
Outdated
Show resolved
Hide resolved
fdfed63
to
43bfcaa
Compare
dotnet/src/Experimental/Assistants.UnitTests/Extensions/KernelExtensionTests.cs
Show resolved
Hide resolved
dotnet/src/SemanticKernel.Abstractions/Functions/KernelPlugin.cs
Outdated
Show resolved
Hide resolved
dotnet/src/SemanticKernel.Abstractions/Functions/KernelPlugin.cs
Outdated
Show resolved
Hide resolved
dotnet/src/SemanticKernel.Abstractions/Functions/KernelPlugin.cs
Outdated
Show resolved
Hide resolved
dotnet/src/SemanticKernel.Abstractions/Functions/KernelPluginExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/src/SemanticKernel.Core/Functions/DefaultKernelPlugin.cs
Outdated
Show resolved
Hide resolved
dotnet/src/SemanticKernel.Core/Functions/DefaultKernelPlugin.cs
Outdated
Show resolved
Hide resolved
dotnet/src/SemanticKernel.Core/Functions/DefaultKernelPlugin.cs
Outdated
Show resolved
Hide resolved
dotnet/src/SemanticKernel.Core/Functions/KernelPluginFactory.cs
Outdated
Show resolved
Hide resolved
dotnet/samples/KernelSyntaxExamples/Resources/Example73_MutableKernelPlugin.cs
Outdated
Show resolved
Hide resolved
dotnet/samples/KernelSyntaxExamples/Resources/Example73_MutableKernelPlugin.cs
Outdated
Show resolved
Hide resolved
dotnet/samples/KernelSyntaxExamples/Resources/Example73_MutableKernelPlugin.cs
Outdated
Show resolved
Hide resolved
…ft#4084) ### Motivation and Context Changing `IKernelPlugin` to be abstract class `KernelPluginBase` so that we have the flexibility to extend that we get from abstract classes. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
Motivation and Context
Changing
IKernelPlugin
to be abstract classKernelPluginBase
so that we have the flexibility to extend that we get from abstract classes.Description
Contribution Checklist