Skip to content

fix(chat): accept reasoning alias in completion messages - #834

Merged
iBotPeaches merged 1 commit into
openai-php:mainfrom
pcbeingused333:fix/chat-message-reasoning-c2161
Nov 9, 2026
Merged

iBotPeaches merged 1 commit into
openai-php:mainfrom
pcbeingused333:fix/chat-message-reasoning-c2161

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Non-streamed chat completions lose reasoning when an OpenAI-compatible server returns message.reasoning, as vLLM's ChatMessage does (the server #751 added streaming support for): CreateResponseMessage::from() only reads reasoning_content, so reasoningContent is null.

What:

  • Bug Fix
  • New Feature

Description:

Accept reasoning as a fallback for reasoning_content, extending the alias support from #824 to non-streamed messages. The existing reasoning_content field keeps precedence, including empty strings, and toArray() continues to emit reasoning_content.

Five regression cases cover the alias, precedence, null fallback, empty content and absent reasoning. Before the fix, two cases fail; after it, all five pass. The full Pest suite passes (1428 passed, 34 deprecation notices); PHPStan passes and Pint formats both changed files.

Related:

Related to #780 and #824. This addresses the non-streamed counterpart; the original streaming issue is already closed.

This change was prepared with an AI coding assistant (Codex).

@iBotPeaches
iBotPeaches merged commit 6651e7d into openai-php:main Nov 9, 2026
14 checks passed
@iBotPeaches

Copy link
Copy Markdown
Collaborator

thanks!

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