-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
Expected Behavior
Perhaps I am not doing this correctly. If so, please point me in the direction.
OpenAI GPT-4 and on allow you to upload a PDF as part of the chat request. So, something like this should be possible:
byte[] fileData = ...
Media media = Media.builder().data(fileData).mimeType(DOC_PDF).build();
Prompt prompt = new Prompt(
List.of(new UserMessage("extract text from the following PDF document."),
new UserMessage("some text here", media)), openAiChatOptions);
CallResponseSpec callResponseSpec = chatClient.prompt(prompt).call();
ChatResponse chatResponse = callResponseSpec.chatResponse();
Current Behavior
While the above compiles, even with GPT-4o (which supports this), I get the following error:
org.springframework.ai.retry.NonTransientAiException: 400 - {
"error": {
"message": "Invalid MIME type. Only image types are supported.",
"type": "invalid_request_error",
"param": null,
"code": "invalid_image_format"
}
}
Pretty clear - can't use a PDF document as part of a UserMessage. I am not currently aware of a workaround, but if there is one, please point me to it.
Much appreciated!
Metadata
Metadata
Assignees
Labels
No labels