We are getting a Syntax Error back (getMessage()) and it is reporting an error code (getErrorCode()) = 0... That makes PHP throw a fatal exception as the method has a return type of ?string, but it is an int.
The issue is that you are using declare(strict_types=1) (it never helps at all), because 0 can be converted to a string automatically by PHP...
Description
We are getting a
Syntax Error
back (getMessage()
) and it is reporting an errorcode
(getErrorCode()
) =0
... That makes PHP throw a fatal exception as the method has a return type of?string
, but it is anint
.The issue is that you are using
declare(strict_types=1)
(it never helps at all), because0
can be converted to a string automatically by PHP...Related issue: https://github.com/openai-php/client/issues/151
The related file causing problems is: src/Exceptions/ErrorException.php
Steps To Reproduce
I do not have the input that was sent, but we are using:
OpenAI::chat()->create($parameters);
OpenAI PHP Client Version
v0.6.2 (laravel pacakge v0.6.0)
PHP Version
8.1.22
Notes
No response