10
Views
2
Comments
Azure OpenAI error in ODC: PDF passed as ImageBinary causing BadRequest

Hi everyone,

I am currently following the OutSystems ODC AI training and encountered an error while calling the AI model.

The error message I receive is:

Failed to call AI model. Status code: BadRequest. The Azure OpenAI AI model provider returned this message: "Invalid image URL: 'messages[1].content[2].image_url.url'. Expected a base64-encoded data URL with an image MIME type (e.g. data:image/png;base64,...), but got unsupported MIME type 'application/pdf'."

From my investigation, I realized that the file I am passing into the AI message is a PDF, but the AIContentType I am using is ImageBinary.

Currently the built-in static entity AIContentType only has these records:

  • ImageBinary

  • ImageURL

  • TextContent

Since my file is a PDF, it seems the model is trying to treat it as an image and fails.

My questions are:

  1. Is ImageBinary only meant for actual image formats like PNG/JPG?

  2. What is the correct way to send PDF files to the AI model in ODC?

  3. Should I convert the PDF to text or images before sending it to the model?

  4. Or is there a recommended content type for document inputs like PDFs?

I am currently using the TrialGPT4o model in ODC.

Any guidance would be appreciated. Thanks!



Image 1.png
PayStub6.pdf
UserImage.jpg
Lucas Lee

Fixed it by switching the another ai. TrialClaude3_7Sonnet. For some reason TrialGPT was not working. But why?

2018-12-10 12-16-21
Goncalo Duarte Almeida

GPT-4o does not support the PDF file format. When you use ImageBinary, the model expects a standard image file (like PNG or JPG). Passing a PDF triggers a MIME type error because the model cannot "see" inside a PDF container.

 Claude 3.7 Sonnet works because has built-in Document Support. Its API is designed to handle PDFs directly.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.