.Net: Getting empty response when i call the planner
Describe the bug I'm sorry if it's not a bug but I tried everything and i can't find a fix. I'm getting this issue where calling the planner in the latest version results in an empty response. Also, I tested this with the planner sample project, specifically the MathSolver. https://github.com/MicrosoftDocs/semantic-kernel-docs/tree/main/samples/dotnet/11-Planner
To Reproduce Steps to reproduce the behavior:
- Run the project.
- Ask AI to add two numbers 2 and 1.
- Return empty response.
I'm getting empty response for any question that trigger the planner.
Expected behavior It should return a response.
Screenshots not applicable
Platform
- OS: Windows
- IDE: Visual Studio
- Language: C#
- Source: NuGet package version 1.1.0
Additional context None
@Cobra86, are you able to share what the generated Handlebars planner looks like when there is an "empty response"? This might be a regression on the Handlebars planner.
It's not hitting the Handlebars method. This is program.cs for the test project. I'm using the MathSolver from semantic kernel samples
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.ChatCompletion;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using TestOpenAIConsoleApp;
using ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
{
builder
.SetMinimumLevel(0)
.AddDebug();
});
// Create kernel
var builder = Kernel.CreateBuilder();
builder.AddAzureOpenAIChatCompletion(
endpoint: ", // Azure OpenAI Endpoint
apiKey: ""); // Azure OpenAI Key;
builder.Services.AddLogging(c => c.AddDebug().SetMinimumLevel(LogLevel.Trace));
builder.Plugins.AddFromType<MathSolver>();
//builder.Plugins.AddFromType<MathSolver>();
var kernel = builder.Build();
ChatHistory Messages = [];
// Get chat completion service
var chatCompletionService = kernel.GetRequiredService<IChatCompletionService>();
// Start the conversation
while (true)
{
// Get user input
Console.Write("User > ");
Messages.AddUserMessage(Console.ReadLine()!);
// Enable auto function calling
OpenAIPromptExecutionSettings openAIPromptExecutionSettings = new()
{
ToolCallBehavior = ToolCallBehavior.AutoInvokeKernelFunctions
};
// Get the response from the AI
var result = chatCompletionService.GetStreamingChatMessageContentsAsync(
Messages,
executionSettings: openAIPromptExecutionSettings,
kernel: kernel);
// Stream the results
string fullMessage = "";
var first = true;
await foreach (var content in result)
{
if (content.Role.HasValue && first)
{
Console.Write("Assistant > ");
first = false;
}
Console.Write(content.Content);
fullMessage += content.Content;
}
Console.WriteLine();
// Add the message from the agent to the chat history
Messages.AddAssistantMessage(fullMessage);
}
It appears there was an issue with Azure OpenAI UK, but I can now see the response. I'll keep this issue open, as it seems the code isn't handling it properly.
We got word that it's been fixed. Are you still getting the issue?
Yes, It's fixed. In future, will the code handle this issue? I'm not sure what was the issue and is it good practice to throw error when the response is empty ?
This issue is stale because it has been open for 90 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.