Skip to content

Conversation

louisbels
Copy link
Contributor

What:

  • Bug Fix
  • New Feature

Description:

Adds support for the new reasoning text streaming events introduced in OpenAI's Response API when using models with reasoning capabilities (like gpt-oss):

  • response.reasoning_text.delta - Emitted when a delta is added to reasoning text content
  • response.reasoning_text.done - Emitted when reasoning text is completed

These events are documented in the OpenAI API Reference and are used when models perform step-by-step reasoning before
generating their response.

Changes made:

  • Created ReasoningTextDelta class to handle reasoning text delta events
  • Created ReasoningTextDone class to handle completed reasoning text events
  • Updated CreateStreamedResponse to recognize and properly parse these new event types
  • Added test coverage with fixtures and test cases for both event types

Related:

N/A - Feature addition based on OpenAI API updates

Copy link
Collaborator

@iBotPeaches iBotPeaches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor comment. You see how you include type and then typecast it as a generic string? Since we read the type prior to passing it to the child concrete class - we know the type.

So we exclude it, so it doesn't pack an object with an unneeded key. You can peek the other classes to see what I mean - https://github.com/openai-php/client/tree/main/src/Responses/Responses/Streaming

Basically remove type as we let the calling code handle/set that.

@iBotPeaches iBotPeaches merged commit 166ab20 into openai-php:main Sep 3, 2025
12 checks passed
@iBotPeaches
Copy link
Collaborator

thanks!

@iBotPeaches iBotPeaches added this to the v0.17.0 milestone Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants