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:
Is ImageBinary only meant for actual image formats like PNG/JPG?
What is the correct way to send PDF files to the AI model in ODC?
Should I convert the PDF to text or images before sending it to the model?
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!
Fixed it by switching the another ai. TrialClaude3_7Sonnet. For some reason TrialGPT was not working. But why?
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.