Description
Describe the bug
The preview OpenAIResponseAgent
throws a System.NotImplementedException
: 'Unsupported response item: OpenAI.Responses.ReasoningResponseItem'
for reasoning responses (from o4-mini etc.). It is uncatchable since OpenAIResponseExtensions
and the related classes are internal.
To Reproduce
Steps to reproduce the behavior:
- Set up an
OpenAIResponseAgent
using an OpenAI reasoning model e.g. o4-mini - Invoke the agent (in my case with
InvokeStreamingAsync()
) - Wait for the first reasoning response to be received
- Error is thrown by the
ToChatMessageContentItemCollection()
extension method inOpenAIResponseExtensions
.
Expected behavior
ToChatMessageContentItemCollection()
should handle the ReasoningResponseItem
and return a ChatMessageContentItemCollection
containing ReasoningContent
objects. (if this is not supported yet, it could at least accept the ReasoningResponseItem
and do nothing/just log it - throwing an error renders the OpenAIResponseAgent unusable with reasoning models...) e.g. the following added at line 95 of OpenAIResponseExtensions.cs:
else if (item is ReasoningResponseItem reasoningResponseItem)
{
var collection = new ChatMessageContentItemCollection();
foreach (string part in reasoningResponseItem.SummaryTextParts)
{
collection.Add(new ReasoningContent(part));
}
return collection;
}
Platform
- Language: C#
- Source: NuGet package (Microsoft.SemanticKernel.Agents.OpenAI) version 1.57.0-preview
- AI model: OpenAI:o4-mini
- IDE: VS Code
- OS: Mac
Metadata
Metadata
Assignees
Type
Projects
Status