Turning Plain Old C# Methods to Semantic Kernel Functions #1694
Replies: 2 comments 2 replies
-
With changes that were merged into SK last week, you can now write your function as almost exactly what you want to write. It'll now be: [SKFunction, Description("Adds two numbers together")]
public static double Add([Description("The first number to add")] double first, [Description("The second number to add")] double second)
{
return first + second;
} The I believe @shawncal was working on getting a new version of the nuget published that has this support. He can comment on whether that's happened yet. |
Beta Was this translation helpful? Give feedback.
-
I just noticed that this has been pushed in pre-release nuget package: https://github.com/microsoft/semantic-kernel/releases/tag/dotnet-0.17.230626.1-preview This is the PR for reference: Thanks again! |
Beta Was this translation helpful? Give feedback.
-
I got really excited while reading this: Adding native functions to the kernel as I have a lot of static methods that do different things that I'd like to chain together.
However, it seems that I'd have to write a new method to get this to be added as an SK plugin:
I'm trying to think of ideas of the easiest way I can get this to work since this is tedious for all the methods I want to add as SK Functions.
I'm not tool well versed in C#, but seems possible to (and would be really nice to have if we could) annotate existing methods with descriptions of the parameters (without converting from string to some type, then back into a string)
Please give me any ideas of how to easily convert my existing static c# methods into SKFunctions. (Preferably without calling a code generator)
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions