I’m sending several URLs in a single request to GPT-4 Vision, and three out of five times I get not informative error message: ‘Invalid image.’, type: ‘invalid_request_error’. The URLs change dynamically, so predicting the set of these URLs is impossible.
I’ve collected the problematic images but still can’t identify the issue with them. I have checked all the links manually; they are all in PNG, JPEG, or WEBP format, as per the requirements. They vary in format, size, and domain, so no common parameters are evident. Moreover, the API doesn’t specify the exact problem.
Here are examples of the problematic URLs:
- https://s3.amazonaws.com/thumbnails.venngage.com/template/224aa448-5adf-4287-aca7-ce09cc177fd8.png
- https://info.methodlearning.com/hubfs/schedule.jpg
The most frustrating part is that if even one image causes an issue, the entire request fails, preventing the handling of other data. The API also doesn’t indicate which specific URL is problematic, does not skip it, so it’s impossible to dynamically handle the error.
Here’s an example of the request:
model: 'gpt-4-vision-preview',
messages: [
{
role: 'user',
content: [
{ type: 'text', text: 'What image URL is the most relevant for the topic {topic}? Return the URL and describe what this picture is about.' },
{
type: 'image_url',
image_url: {
'url': 'https://i.ytimg.com/vi/qRE0WicGz4I/maxresdefault.jpg',
'detail': 'auto'
},
},
{
type: 'image_url',
image_url: {
'url': 'https://jdadvising.com/wp-content/uploads/2014/12/Sample-Daily-Bar-Exam-Study-Schedule.png',
'detail': 'auto'
},
},
{
type: 'image_url',
image_url: {
'url': 'https://shovelapp.io/wp-content/uploads/2022/07/Study-Schedule-needs-to-show-all-your-time-commitments-1024x576.png',
'detail': 'auto'
},
},
{
type: 'image_url',
image_url: {
'url': 'https://info.methodlearning.com/hubfs/schedule.jpg',
'detail': 'auto'
},
},
{
type: 'image_url',
image_url: {
'url': 'https://i.ytimg.com/vi/qRE0WicGz4I/hqdefault.jpg',
'detail': 'auto'
},
},
]
},
],
temperature: 0.1,
max_tokens: 500,
},
How can I localise the problem and what does this error mean?