Closed PandaJu closed 10 months ago
Piggybacking here to also point out a typo in some comments that does not justify its own issue. It's "thred" instead of "thread" in four files.
Hi @PandaJu
According to the docs instructions
is nullable on the Assistant
but not on the ThreadRun
. See: https://github.com/openai/openai-openapi/blob/master/openapi.yaml#L8092
Do you have an example request where you get null
?
Hi @LMCom
Fixed. Please open a separate issue next time.
When creating Assistants using the Assistants feature on the left side of OpenAI, and if the Instructions field is left empty, it will result in the following error:
Fatal error: Uncaught TypeError: OpenAI\Responses\Threads\Runs\ThreadRunResponse::__construct(): Argument #15 ($instructions) must be of type string, null given.
I apologize for any confusion caused. Upon reviewing the OpenAI API documentation again, I can confirm that the "instructions" field is indeed optional and can accept a value of null.
You are right. This is an error in the OpenAI documentation. The field can be null.
I've pushed a fix to the 0.8.x branch and will make a new beta release in a couple of minutes.
I hope this message finds you well. I wanted to bring to your attention a small typo in the
ThreadRunResponse
class in theThreadRunResponse.php
file. It appears that the type definition for the$instructions
property is incorrect.According to the OpenAI API documentation, the
$instructions
property can be nullable (i.e., it can have a value ofnull
). However, in theThreadRunResponse
class, it is defined as a string type without the nullable annotation.This typo may lead to a fatal error when the constructor of the
ThreadRunResponse
class is invoked with anull
value for the$instructions
parameter.To resolve this issue and align with the API documentation, I suggest modifying the type declaration for the
$instructions
property in theThreadRunResponse
class to allow null values. The updated property definition should look like this:By making this change, you will ensure that the code handles both string and null values correctly and avoids any potential runtime errors.
Thank you for your attention to this matter. I appreciate your efforts in maintaining the OpenAI PHP client library and ensuring its accuracy.