microsoft / semantic-kernel

Integrate cutting-edge LLM technology quickly and easily into your apps
https://aka.ms/semantic-kernel
MIT License
21.15k stars 3.1k forks source link

.Net: Bug: "GetStreamingChatMessageContentsAsync" is not working properly #6919

Open EachShow opened 2 months ago

EachShow commented 2 months ago

Describe the bug "GetStreamingChatMessageContentsAsync" is not working properly

To Reproduce update Microsoft.SemanticKernel.Connectors to V1.15.0

Expected behavior Receive streaming output correctly

Screenshots

Platform

Additional context the exception info: Method not found: 'System.String Microsoft.SemanticKernel.FunctionResultContent.get_Id()'.|System.MissingMethodException: Method not found: 'System.String Microsoft.SemanticKernel.FunctionResultContent.get_Id()'. at Microsoft.SemanticKernel.Connectors.OpenAI.ClientCore.GetRequestMessages(ChatMessageContent message, ToolCallBehavior toolCallBehavior) at Microsoft.SemanticKernel.Connectors.OpenAI.ClientCore.CreateChatCompletionsOptions(OpenAIPromptExecutionSettings executionSettings, ChatHistory chatHistory, Kernel kernel, String deploymentOrModelName) at Microsoft.SemanticKernel.Connectors.OpenAI.ClientCore.GetStreamingChatMessageContentsAsync(ChatHistory chat, PromptExecutionSettings executionSettings, Kernel kernel, CancellationToken cancellationToken)+MoveNext() at Microsoft.SemanticKernel.Connectors.OpenAI.ClientCore.GetStreamingChatMessageContentsAsync(ChatHistory chat, PromptExecutionSettings executionSettings, Kernel kernel, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource.GetResult()

RogerBarreto commented 2 months ago

@EachShow, mind providing some pieces of the code you are using?

This is a very central API method where we have plenty of UnitTests, we need to understand what's the context of this error.

Are you using it against OpenAI/Azure OpenAI or Non-OpenAI models?

DoguhanHarmanda commented 1 month ago

@RogerBarreto I was able to reproduce this issue by also adding the Google connector package: Microsoft.SemanticKernel.Connectors.Google" Version="1.15.0-alpha" When you then try using the OpenAIChatCompletion, you will encounter the error.

EachShow commented 1 month ago

// I using it against Azure OpenAI

var chat = new AzureOpenAIChatCompletionService(....); var response = chat.GetStreamingChatMessageContentsAsync(chatHistory);

await foreach (var item in response) // the exception is occurred here { // do something }