Description
Description
According to OpenAI Documentation, it is possible to add a PDF file content in base64 format to a chat request.
https://platform.openai.com/docs/guides/pdf-files?api-mode=responses
I tried the following syntax :
$gpt->client->chat()->create([
'model' => 'gpt-4o',
'response_format' => array('type'=>'json_object'),
'messages' => [
['role' => 'user', 'content' => $prompt],
['role' => 'user', 'content' => [
'type' => 'input_file',
'filename' => $filename,
'file_data' => 'data:application/pdf;base64,'.$base64_content
] ]
],
]);
And it gives this critical error:
Fatal error: Uncaught OpenAI\Exceptions\ErrorException: Invalid type for 'messages[1].content': expected one of a string or array of objects, but got an object instead. in...
Can you explain me why?
Steps To Reproduce
Try the provided code
OpenAI PHP Client Version
0.10.3
PHP Version
8.3.19
Notes
No response