Closed udgithub closed 6 months ago
OK, I found the solution: Your documenation said: `$client->files()->download($file); So I retrieved the file info. But now it works, when I use the fileId:
$imageFileId = $contentPart->imageFile->fileId;
# don't do THIS: $imageFile = $client->files()->retrieve($imageFileId);
$imageData = $client->files()->download($imageFileId);
Sorry for misunderstanding your excellent documentation.
Description
Hello guys,
first of all: thanks for your great development. So I as an PHP developer can use OpenAI API almost as convenient as with Python.
Now the problem: If I go through all messages I can find a $contentPart->type of "image_file" . If I try to get the image data like this:
I get an error: Fatal error: Uncaught TypeError: OpenAI\Responses\Files\RetrieveResponse::__construct(): Argument #3 ($bytes) must be of type int, null given, called in /my-project-path/vendor/openai-php/client/src/Responses/Files/RetrieveResponse.php on line 51 and defined in /my-project-path/vendor/openai-php/client/src/Responses/Files/RetrieveResponse.php on line 30
That is the loop to process the messages:
It would be great if you could give me an hint what I'm doing wrong or fix the bug if it is one. Thanks a lot in advance for your help.
Steps To Reproduce
create an assistant of type code_interpreter and send a request like plot these numbers in a graph: 1,2,3,4,15,73,12 then try to read the messages and download the imageFile
OpenAI PHP Client Version
0.8.1
PHP Version
8.1.2
Notes
No response