-
Notifications
You must be signed in to change notification settings - Fork 855
Description
Description
In streaming mode, with at least a responses client, FunctionCallOutputResponseItem is not converted into FunctionResultContent. However, the non-streaming method converts it correctly.
There is difference between OpenAIResponsesChatClient.GetStreamingResponseAsync and OpenAIResponsesChatClient.GetResponseAsync while converting OpenAI types to MEAI types.
In non-streaming mode, ToChatMessage correctly converts FunctionCallOutputResponseItem to FunctionResultContent (Here)
But the conversion is absent in streaming mode. FromOpenAIStreamingResponseUpdatesAsync does not handle FunctionCallOutputResponseItem(Here), so the result defaults to AIContent.
That means both of those snippets produce different results if there is a tool call output
var res1 = await chatClient
.GetStreamingResponseAsync(messages)
.ToChatResponseAsync();gives:
var res2 = await chatClient.GetResponseAsync(messages);
gives:
Reproduction Steps
Here is a minimal repro: https://github.com/vsantele/dotnet-extensions-bug-repro-7306
I discovered this bug while using the Microsoft Agent Framework with the OpenAI Hosting layer. But I don't think MAF is related to this issue.
Expected behavior
If there is a response.output_item.done event with an item function_call_output in a stream response, a FunctionResultContent is present in the response from a IChatClient
Actual behavior
This event is not converted to FunctionResultContent but to a AIContent.
Regression?
I don't know
Known Workarounds
No response
Configuration
dotnet: 10.0.103
Microsoft.Extensions.AI.Abstractions: 10.3.0
Microsoft.Extensions.AI.OpenAI: 10.3.0
Windows: 11
Other information
No response