Hello, I’m having trouble sending dynamic image URLs via API to ChatGPT vision to extract text.
I have image uploaders, and images are saved into database, after uploaded by user without login.
I need to send those images to ChatGPT Vision for text extraction, bud i cannot find a proper way to extract those images URLs and add them as dynamic values to JSON body.
I have this JSON body setup:
{
“model”: “gpt-4o”,
“messages”: [
{
“role”: “system”,
“content”: “You are a helpful assistant that extracts text from images.”
},
{
“role”: “user”,
“content”: [
{
“type”: “text”,
“text”: “Extract the text from the following images:”
},
{
“type”: “image_url”,
“image_url”: {
“url”: “<File1_url>”
}
},
{
“type”: “image_url”,
“image_url”: {
“url”: “<File2_url>”
}
},
{
“type”: “image_url”,
“image_url”: {
“url”: “<File3_url>”
}
},
{
“type”: “image_url”,
“image_url”: {
“url”: “<File4_url>”
}
},
{
“type”: “image_url”,
“image_url”: {
“url”: “<File5_url>”
}
},
{
“type”: “image_url”,
“image_url”: {
“url”: “<File6_url>”
}
},
{
“type”: “image_url”,
“image_url”: {
“url”: “<File7_url>”
}
},
{
“type”: “image_url”,
“image_url”: {
“url”: “<File8_url>”
}
}
]
}
],
“max_tokens”: 300
}
With this JSON body i can’t initialize call because of invalid image.
But i don’t know how to insert those dynamic values (image URLs), uploaded by user, into dynamic values from database.
Can anyone please help me with that?
Thank you very much.