-
-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Undefined array key "file_id #456
Comments
I have the same issue. I am trying to do something like: 'thread' => [
'messages' => [[
'role' => 'user',
'content' => [
[ 'type' => 'text', 'text' => $description ],
[ 'type' => 'image_url', 'image_url' => [ 'url' => 'https://example.com/image.jpg']],
],
]],
], From what I can understand, the issue is originating inside return new self(
$attributes['type'],
ThreadMessageResponseContentImageUrl::from($attributes['image_url']),
);
public static function from(array $attributes): self
{
return new self(
$attributes['file_id'],
$attributes['detail'] ?? null,
);
} So it fails. |
Everyone having the same issue, this is the fix:
|
@jumaskow @SergiuDihel thank you for your responses. I did the same and I was about to send a PR but I found out that issue is fixed at https://github.com/openai-php/client/blob/main/src/Responses/Threads/Messages/ThreadMessageResponseContentImageUrl.php but not released yet. I just replaced the version with "dev-main" until there's a release. Thank you again! :) |
Hey @ckefalianou! The commit fixing this issue is here: It was merged on June 7, with this PR: But it is not yet released, as you've said. For time being, I also currently use the current latest commit on UPDATE: |
Going to make a new release tomorrow. Sorry for the long waiting time. |
Description
Undefined array key "file_id"
I did some digging, and found out that the issue is created in that file: openai-php/client/src/Responses/Threads/Messages/ThreadMessageResponseContentImageUrl.php
because it looks for file_id not url , which file_id doesn't exist in the content I sent.
Can you please resolve it or suggest a solution?
Thank you in advance!
Steps To Reproduce
I am using the library, sending a text and some image_url as content.
After retrieving the Assistant, creating a Thread, I create the following Message:
$openAI_message = $client->threads()->messages()->create($openAI_thread->id, [ 'role' => 'user', 'content' => [ [ 'type' => 'text', 'text' => $prompt['title'] ], [ 'type' => 'image_url', 'image_url' => [ 'url' => $photo[0]->large, 'detail' => 'high', ], ], [ 'type' => 'image_url', 'image_url' => [ 'url' => $photo[1]->large, 'detail' => 'high', ], ], ] ]);
After creating the Run I get the following issue: Undefined array key "file_id"
OpenAI PHP Client Version
^0.10.1
PHP Version
8.3
Notes
No response
The text was updated successfully, but these errors were encountered: