Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: NULL finish_reason for completions #51

Closed
afedukov opened this issue Feb 26, 2023 · 2 comments
Closed

Error: NULL finish_reason for completions #51

afedukov opened this issue Feb 26, 2023 · 2 comments

Comments

@afedukov
Copy link

Sometimes getting error:

OpenAI\Responses\Completions\CreateResponseChoice::__construct(): Argument #4 ($finishReason) must be of type string, null given, called in /var/www/vendor/openai-php/client/src/Responses/Completions/CreateResponseChoice.php on line 24

$attributes from \OpenAI\Responses\Completions\CreateResponseChoice::from:

array(4) {
  ["text"]=>
  string(972) " ... somthing here ... "
  ["index"]=>
  int(0)
  ["logprobs"]=>
  NULL
  ["finish_reason"]=>
  NULL
}
@careybaird
Copy link
Contributor

Duplicate of #50

careybaird added a commit to careybaird/client that referenced this issue Feb 26, 2023
A recent change to the OpenAI API means that finish_reason is sometimes returned as NULL and causes an exception.

This change allows finishReason to be nullable.
nunomaduro added a commit that referenced this issue Feb 27, 2023
Make finishReason nullable #51
@nunomaduro
Copy link
Contributor

Fixed on v0.3.2.

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

No branches or pull requests

3 participants