Skip to content

How can you combine both prompt functions and native code functions in one plugin? #5709

Answered by stephentoub
Valkozaur asked this question in Q&A
Discussion options

You must be logged in to vote

You can create a new plugin that contains all the functions from other plugins, e.g.

KernelPlugin plugin1 = ...;
KernelPlugin plugin2 = ...;
KernelPlugin combined = KernelPluginFactory.CreateFromFunctions("MyCoolPlugin", [..plugin1, ..plugin2]);

You can also write your own KernelPlugin-derived types. Here's an example of writing and using a mutable one that let's you add and remove functions.
https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/KernelSyntaxExamples/Example69_MutableKernelPlugin.cs

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Valkozaur
Comment options

Answer selected by Valkozaur
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants