Skip to content

.Net: Error on "kernel.RunAsync" #4009

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

Closed
markwallace-microsoft opened this issue Dec 5, 2023 · 6 comments
Closed

.Net: Error on "kernel.RunAsync" #4009

markwallace-microsoft opened this issue Dec 5, 2023 · 6 comments
Assignees
Labels
docs and tests Improvements or additions to documentation .NET Issue or Pull requests regarding .NET code sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community) triage v1.0.1 Required for the Semantic Kernel v1.0.1 release

Comments

@markwallace-microsoft
Copy link
Member

Describe the bug
Hello, i have trouble getting Semantic Kernel running.
the kernel is initialized like this:
var builder = new KernelBuilder();

builder.WithAzureOpenAIChatCompletionService(
"gpt-4-turbo", // Azure OpenAI Deployment Name
"xyz", // Azure OpenAI Endpoint
"xyz"); // Azure OpenAI Key

kernel = builder.Build();

This is my plan: I have 2 sources of functions: a class "CaseManagement", where every function is tagged with [SKFunction]. The other source is a "ChatFunction", that looks like this:

var chatPrompt = @"User: {{$input}}. Assistant: ";
ISKFunction chatFunction = kernel.CreateSemanticFunction(chatPrompt, new OpenAIRequestSettings { ChatSystemPrompt = systemPrompt, ModelId = "gpt-4-turbo" });

The CaseManagement Functions are imported like this:

kernel.ImportFunctions(new BackofficeWorkerAiConsole.Plugins.CaseManagement.CaseManagement(), "CaseManagement");

And the chatFunction is added like this:

kernel.RegisterCustomFunction(chatFunction);

Now when inspecting the kernel afterwards, the chat function does not show up:
(oh i can not paste screenshots? okay nevermind)

So that is the first problem. What do i do wrong with loading the function?

And the actual problem with the planner, when i run this code:

var planner = new StepwisePlanner(kernel);
var plan = planner.CreatePlan(text);

Console.WriteLine(JsonSerializer.Serialize(plan, new JsonSerializerOptions { WriteIndented = true }));

var result = await kernel.RunAsync(plan);

I get this error on "kernel.RunAsync":
System.MissingMethodException: 'Method not found: 'System.Threading.Tasks.Task1<Azure.Response1<Azure.AI.OpenAI.ChatCompletions>> Azure.AI.OpenAI.OpenAIClient.GetChatCompletionsAsync(System.String, Azure.AI.OpenAI.ChatCompletionsOptions, System.Threading.CancellationToken)'.'

I tried to follow the "Microsoft Learn" pages to stich this together, but i feel like i miss something. What am i missing?

@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code v1 bugbash v1.0.1 Required for the Semantic Kernel v1.0.1 release labels Dec 5, 2023
@github-actions github-actions bot changed the title Error on "kernel.RunAsync" .Net: Error on "kernel.RunAsync" Dec 5, 2023
@shawncal shawncal added the triage label Dec 5, 2023
@sonicjoy
Copy link

sonicjoy commented Dec 6, 2023

Same here, I tried to follow the Learning site but those code samples are not working, looks like a lot of methods have been changed, including the import plugins and RunAsync, can anyone update the documents please?

@matthewbolanos
Copy link
Member

can anyone update the documents please?

Yes, we'll be updating all of the documents on learn.microsoft.com to reflect all of the name changes. They should be entirely updated by Monday.

@alexminza
Copy link

alexminza commented Dec 6, 2023

Examples and notebooks are also not updated after the massive breaking changes in RC1 and RC2. This makes the transition very difficult and frustrating. These breaking changes are also not properly documented nor described in issues and difficult to find in commits and pull requests.

@DmtDhanushka
Copy link

DmtDhanushka commented Dec 8, 2023

Same here, I tried to follow the Learning site but those code samples are not working, looks like a lot of methods have been changed, including the import plugins and RunAsync, can anyone update the documents please?

Yes, I am experiencing the same issue. I am sure they would fix it soon btw

@matthewbolanos
Copy link
Member

We are actively working on updating all of our documentation. In the meantime, we recommend that folks leverage the KernelSyntaxExamples: https://github.com/microsoft/semantic-kernel/tree/main/dotnet/samples/KernelSyntaxExamples

All of these samples are up-to-date with the latest changes.

@markwallace-microsoft markwallace-microsoft moved this to Sprint: Planned in Semantic Kernel Dec 11, 2023
@markwallace-microsoft markwallace-microsoft moved this from Sprint: Planned to Sprint: In Progress in Semantic Kernel Dec 11, 2023
@evchaki evchaki added the sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community) label Dec 11, 2023
@markwallace-microsoft markwallace-microsoft added the docs and tests Improvements or additions to documentation label Dec 14, 2023
@matthewbolanos
Copy link
Member

Closing this since the docs have now been updated.

@github-project-automation github-project-automation bot moved this from Sprint: In Progress to Sprint: Done in Semantic Kernel Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs and tests Improvements or additions to documentation .NET Issue or Pull requests regarding .NET code sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community) triage v1.0.1 Required for the Semantic Kernel v1.0.1 release
Projects
Archived in project
Development

No branches or pull requests

7 participants