Bedrock Structured Output
Some models on Bedrock now support native structured output: https://aws.amazon.com/about-aws/whats-new/2026/02/structured-outputs-available-amazon-bedrock/
Please add support in AdvisorParams.ENABLE_NATIVE_STRUCTURED_OUTPUT for this.
Thanks for sharing this @jamesward
To add native SO support to a ChatModel, you only need to extend its ChatOptions to implement the StructuredOutputChatOptions interface.
For reference: https://github.com/spring-projects/spring-ai/blob/ac9254fa55085115274ce981de226519181845aa/models/spring-ai-openai-sdk/src/main/java/org/springframework/ai/openaisdk/OpenAiSdkChatOptions.java#L47
Hi @jamesward @tzolov ! I've started working on this issue and submitted a PR that implements StructuredOutputChatOptions in BedrockChatOptions.
What was done
BedrockChatOptionsnow implementsStructuredOutputChatOptions- Added
outputSchemafield with getter/setter and Builder support - Added unit tests
Current limitation
The current AWS SDK version (2.36.3) used by Spring AI does not include the OutputConfig class for the Converse API yet. So the output schema is stored as a plain String field for now, consistent with how other providers like Google GenAI handle it.
Once the AWS SDK dependency is upgraded to a version that includes OutputConfig, BedrockProxyChatModel can be updated to pass the schema to the Converse API via outputConfig.textFormat.
PR: #5501
Can you bump to a newer AWS SDK to address that?
Hello @jamesward, I believe upgrading the SDK version is not something I can decide on my own, as it may cause side effects in the existing logic.
However, I have pre-implemented the following changes in BedrockProxyChatModel so that
structured output works immediately once the aws bedrockruntime SDK is upgraded to version
2.41.22 or above.
- Added
.outputConfig(buildOutputConfig(updatedRuntimeOptions))when buildingConverseRequestincreateRequest() - Added
.outputConfig(converseRequest.outputConfig())when buildingConverseStreamRequestininternalStream() - Added
outputSchemamerge logic between runtime/default options inbuildRequestPrompt() - Added
buildOutputConfig()private method — converts theoutputSchemaString into theOutputConfig > OutputFormat > OutputFormatStructure > JsonSchemaDefinitionstructure
The OutputConfig, OutputFormat, OutputFormatStructure, and JsonSchemaDefinition classes
are available starting from SDK version 2.41.22, and both Converse and ConverseStream APIs
support structured output.
Usually AWS Java SDK updates are compatible. So it'd be great to have the required version bump in the PR. Then hopefully some automated integration tests will catch any possible regressions. I can also do some manual testing.
Hi @jamesward,
I've updated the PR to include the AWS SDK version bump (2.36.3 → 2.41.22) and the full structured output integration in BedrockProxyChatModel.
Added:
- buildOutputConfig() to convert outputSchema into AWS OutputConfig
- outputConfig support for both ConverseRequest and ConverseStreamRequest
- outputSchema merge logic between runtime/default options
Build and unit tests pass successfully.
Hi @tzolov ! just wanted to gently follow up on this PR. It's been a couple of weeks since the last update and we haven't received any feedback yet. This adds native structured output support for Amazon Bedrock, which resolves #5445. Would really appreciate a review when you get a chance.
happy to make any adjustments!