Skip to content

fix(OpenAI): allow null names and boolean choice values in Decisions - #815

Merged
iBotPeaches merged 1 commit into
openai-php:mainfrom
APX403:decisions-null-names
Oct 14, 2026
Merged

iBotPeaches merged 1 commit into
openai-php:mainfrom
APX403:decisions-null-names

Conversation

@APX403

@APX403 APX403 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

What:

  • Bug Fix
  • New Feature

Description:

When a question is sent to the Decisions API without a name, its answer comes back with "name": null, and choice values can be booleans as well as strings. The API reference types name as string or null on all four answer types, and choice and the probability value as string or boolean. The classes added in #812 declare them as string, so parsing such a response throws:

TypeError: OpenAI\Responses\Decisions\PredicateAnswer::__construct(): Argument #2 ($name) must be of type string, null given
TypeError: OpenAI\Responses\Decisions\ChoiceProbability::__construct(): Argument #1 ($value) must be of type string, true given

name is now nullable on the four answer classes, and choice and value accept string|bool, the same types as the models in openai-python and openai-node. Decisions is not in a tagged release yet, so no released version has the narrower types.

@iBotPeaches iBotPeaches added this to the v0.22.0 milestone Oct 14, 2026
@iBotPeaches
iBotPeaches merged commit 58cc18e into openai-php:main Oct 14, 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