weiqingy opened a new pull request, #1097: URL: https://github.com/apache/flink-agents/pull/1097
Linked issue: #280 ### Purpose of change Bedrock was the last Java chat model with no native structured-output path. Asking it for a schema did not fall back quietly, it threw, because the connection never overrode the foundation's hook. This wires Converse's `outputConfig` so the provider constrains the response, with the existing prompt-engineered path still handling everything else. Bedrock has no Python connection in this repo, so this is Java-only. The feature needed an SDK bump. `outputConfig` appears on `ConverseRequest` at `bedrockruntime` 2.41.22 and does not exist at 2.41.21, so the pin moves to the first version that has it rather than to the latest. That property is shared with three other modules, so the bump moves them too. They compile and test unchanged, and `NOTICE` follows the resulting dependency set. It is three commits: a refactor that adds a seam for testing the request, the bump on its own, then the feature. Each is meant to be readable without the other two. Two decisions are worth a reviewer's attention. **Which models get the native path.** Support on Bedrock is documented per model, not per family, so the check is an exact match against the ids AWS lists, retried once after stripping a leading inference-profile segment such as `us.` or `eu.`. A family-prefix match would be wrong in a way that matters: AWS documents one Qwen model as unsupported while eight of its siblings are supported. Anything unrecognised takes the prompt fallback, and that includes ARNs, which carry no model information at all, and prompt routers, which do not pick a model until the request runs. Guessing wrong in that direction costs a fallback; guessing wrong in the other costs a runtime error. **How the schema is built.** The AWS SDK has no schema generator, unlike the OpenAI and Anthropic ones, so the schema is derived locally the way the Ollama connection does it. A couple of constraints there are easy to get wrong and are covered by tests: without Jackson awareness the generator ignores `@JsonProperty` names and emits `@JsonIgnore` fields, and without a required check it marks nothing required, which would let an empty document satisfy any schema. Two limitations to be aware of rather than surprised by. Recursive types cannot be used as output schemas, since the generated self-reference is something Bedrock rejects up front. And Bedrock warns that the first request against a new schema can spend up to a few minutes compiling it, which here happens inside an operator, so the first record through a new schema may be far slower than the rest. ### Tests The Bedrock chat-model module goes from 12 tests to 54, all offline. Most of that is coverage this module simply never had. Nothing previously asserted what the connection actually sends, so tools, system messages, inference config and message merging are all tested for the first time. The rest covers the new behaviour: which model ids are accepted and rejected, that the derived schema keeps Jackson property names and marks fields required, and that the native path engages and disengages when it should. Tools and a schema on the same request are also covered, since Bedrock allows both. The three other modules affected by the SDK bump run unchanged, and the full build was run so the packaging step is exercised, since a dependency move is exactly what can break it. What is not covered: none of this calls Bedrock. Those tests need credentials CI does not have, so the request shape is verified and the service's acceptance of it is not. I am verifying that separately against a real endpoint and will report the results here before this is merged. The open questions are whether `outputConfig` is accepted as built, which schema details Bedrock tolerates, and whether an unsupported model errors or quietly ignores the request. ### API No public API is added or changed, and no new configuration. The visible difference is that a Bedrock connection given an output schema on a supported model now returns a schema-constrained response instead of throwing. ### Documentation - [ ] `doc-needed` - [x] `doc-not-needed` - [ ] `doc-included` Nothing user-facing changes in configuration, and the repo has no structured-output docs page for any provider today. ### Was this patch authored or co-authored using generative AI tooling? - [x] Yes - [ ] No Generated-by: Claude Code 2.1.259 (Claude Opus 5) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
