openai-php / laravel

⚡️ OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with OpenAI API
MIT License
2.83k stars 189 forks source link

Undefined array key "file_id" #107

Closed latrell closed 2 weeks ago

latrell commented 5 months ago

I added a message with a picture to the thread and an exception occurred

$message_content = [
    ['type' => 'text', 'text' => '666'],
    ['type' => 'image_url', 'image_url' => ['url' => 'https://www.xxx.xxx/xxx.jpg']],
];

OpenAI::threads()->messages()->create($thread_id, [
    'role' => 'user',
    'content' => $message_content,
]);
Undefined array key "file_id" {"exception":"[object] (ErrorException(code: 0): Undefined array key \"file_id\" at /var/www/html/vendor/openai-php/client/src/Responses/Threads/Messages/ThreadMessageResponseContentImageUrl.php:37)

I found this file and printed $attributes and got the following

{"url":"https://www.xxx.xxx/xxx.jpg","detail":"auto"}
gehrisandro commented 2 weeks ago

Fixed