OpenAI supports structured output as a feature. BeanOutputConverter will be more robust and predictable if SpringAI leverages it.

Expected Behavior BeanOutputConverter uses OpenAI structured output feature when using OpenAI.

Current Behavior BeanOutputConverter asks output format as a portion of prompt.

Context https://platform.openai.com/docs/guides/structured-outputs

Comment From: ThomasVitale

Spring AI supports the OpenAI structured output features and allows to choose between the different strategies supported by the platform. You can find more information in the docs: https://docs.spring.io/spring-ai/reference/api/chat/openai-chat.html#_structured_outputs

Would that help with your use case?