spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

EPIC - Structured Output Improvements

Open markpollack opened this issue 9 months ago • 4 comments

Most AI models now support an option to provide structured output.

  1. Verify that the chat client options for all models that support structured output have a corresponding option.
  2. BeanOutputConverter does not take advantage of this model feature, it relies on prompt engineering which isn't as robuts.
  3. Review issues listed below for further actions/features.

markpollack avatar Apr 17 '25 19:04 markpollack

Issue #1854 can be resolved through PR https://github.com/spring-projects/spring-ai/pull/2754.

dev-jonghoonpark avatar Apr 18 '25 03:04 dev-jonghoonpark

We have the same need here. It would be greatly appreciated to have this feature included in the 1.0 release. This PR (https://github.com/spring-projects/spring-ai/pull/2754) addresses it for OpenAPI, but other models—such as Gemini, Mistral, etc.—also natively support structured output. Are there any plans to support them as well, or is any help needed to make that happen?

mautini avatar Apr 24 '25 12:04 mautini

This is becoming increasingly urgent, as gpt-4.1-mini is more and more often failing to respect JSON schema appended to the prompt. It's possible to work around it with few shot examples, but that's not ideal.

johnsonr avatar Jun 19 '25 08:06 johnsonr

I think this issue has been resolved for openai with this commit https://github.com/spring-projects/spring-ai/pull/1198 by @tzolov ?

apappascs avatar Jun 19 '25 13:06 apappascs