Hello, I am a beginner in OpenAI. I am creating a project, where I want to be able to extract data from invoices as images. Now, I am stuck at extracting text from a photo. In documentation for Vision, I see that the model used is 4o-mini, and the photo was uploaded as a base64. My code, written in C#, looks like this:
var payload = new
{
model = "gpt-4o-mini",
messages = new[]
{
new
{
role = "user",
content = new object[]
{
new { type = "text", text = "Extract all the text from the following image." },
new { type = "image_url", url = new { data = new
{
url = $"data:image/jpeg;base64,{base64Image}"
} } }
}
}
},
max_tokens = 300
};
As a response, I get:
Error: BadRequest, {
"error": {
"message": "Invalid content type. image_url is only supported by certain models.",
"type": "invalid_request_error",
"param": "messages.[0].content.[1].type",
"code": null
}
}
What am I missing? Tried to look through documentations, deprecations, could not find an answer.
Can somebody help me? Thank you in advance