-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
.NETIssue or Pull requests regarding .NET codeIssue or Pull requests regarding .NET codequestionFurther information is requestedFurther information is requested
Description
Hello I am using semantic kernel for a single prompt I want to use. As its a single prompt I do not want to create a plugin with skprompts file. Below is the sample code I have. When I run this code I receive Keynotfound exception saying .
As there is lack of examples I am not sure if we want to import plugins first after creation.
One or more errors occurred. (The plugin collection does not contain a plugin and/or function with the specified names. Plugin name - '', function name - 'topic'.)
Here is the sample code
Kernel kernel = Kernel.CreateBuilder().AddAzureOpenAIChatCompletion(deploymentName, openAiEndpoint, new DefaultAzureCredential()).Build();
var prompt = "Tell me a joke about {{topic}}";
var jokeFunction = kernel.CreateFunctionFromPrompt(prompt, functionName: "JokeFunction");
var jokePlugin = kernel.CreatePluginFromFunctions("JokePlugin", new List<KernelFunction>() { jokeFunction });
KernelArguments args = new KernelArguments
{
{"topic" , "cats" }
};
var result = kernel.InvokeAsync<string>(pluginName: "JokePlugin", functionName: "JokeFunction", args).Result;
Metadata
Metadata
Assignees
Labels
.NETIssue or Pull requests regarding .NET codeIssue or Pull requests regarding .NET codequestionFurther information is requestedFurther information is requested
Type
Projects
Status
Sprint: Done