Bug description
The image generation fails if image size not set e.g. via spring.ai.image.options.openai.size with (Azure) OpenAI with the following error.
org.springframework.ai.retry.NonTransientAiException: 400 - {
"error": {
"code": null,
"message": "'nullxnull' is not one of ['256x256', '512x512', '1024x1024', '1024x1792', '1792x1024'] - 'size'",
"param": null,
"type": "invalid_request_error"
}
}
Bug description The image generation fails if image size not set e.g. via
spring.ai.image.options.openai.size
with (Azure) OpenAI with the following error.It can be fixed by replacing lines https://github.com/spring-projects/spring-ai/blob/e5410d7e8da170c546a79852c2234c2be5a80b97/models/spring-ai-openai/src/main/java/org/springframework/ai/openai/OpenAiImageOptions.java#L156 and https://github.com/spring-projects/spring-ai/blob/e5410d7e8da170c546a79852c2234c2be5a80b97/models/spring-ai-openai/src/main/java/org/springframework/ai/openai/OpenAiImageOptions.java#L177 with
this.size = this.getSize();
Has to be also fixed for AzureOpenAiImageOptions.
Environment Spring AI M3/M4, OpenAi, Dall-E 3
Steps to reproduce Use (Azure) OpenAI and Dall-E 3, and execute an image generation request and don't set
spring.ai.image.options.openai.size
.Expected behavior Image generation should work without setting
spring.ai.image.options.openai.size
.