Skip to content

.Net: Bug: OpenAIResponseAgent 'Unsupported response item: OpenAI.Responses.ReasoningResponseItem' #12511

Open
@dglover1

Description

@dglover1

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:

  1. Set up an OpenAIResponseAgent using an OpenAI reasoning model e.g. o4-mini
  2. Invoke the agent (in my case with InvokeStreamingAsync())
  3. Wait for the first reasoning response to be received
  4. Error is thrown by the ToChatMessageContentItemCollection() extension method in OpenAIResponseExtensions.

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

Labels

.NETIssue or Pull requests regarding .NET codebugSomething isn't working

Type

Projects

Status

Sprint: In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions