fix(ai-proxy): map adaptive effort to sibling output_config in Bedrock - #4205
Open
srpatcha wants to merge 1 commit into
Open
fix(ai-proxy): map adaptive effort to sibling output_config in Bedrock#4205srpatcha wants to merge 1 commit into
srpatcha wants to merge 1 commit into
Conversation
When converting a Claude request with adaptive thinking and an output
effort level to an Amazon Bedrock Converse request, ai-proxy placed
`effort` inside the `thinking` object. Bedrock expects `thinking` and
`output_config` to be sibling fields in additionalModelRequestFields.
Before, a request with:
{ "thinking": { "type": "adaptive" }, "output_config": { "effort": "high" } }
produced:
{ "thinking": { "type": "adaptive", "effort": "high" } }
losing the output_config structure and sending effort at the wrong
nesting level.
Now the two categories are preserved as siblings:
{ "thinking": { "type": "adaptive" }, "output_config": { "effort": "high" } }
Supported effort values remain low/medium/high; unsupported values are
still omitted. Manual extended thinking (budget_tokens) and requests
without adaptive thinking are unaffected.
Updated TestBedrockRequestMapsAdaptiveOutputEffortIntoThinking
accordingly (renamed to ...ToSiblingOutputConfig).
Fixes higress-group#4170
Signed-off-by: Srikanth Patchava <spatchava@meta.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4205 +/- ##
=======================================
Coverage ? 69.25%
=======================================
Files ? 170
Lines ? 33773
Branches ? 0
=======================================
Hits ? 23390
Misses ? 9539
Partials ? 844
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ⅰ. Describe what this PR does
Fixes #4170
When
ai-proxyconverts a Claude request with adaptive thinking and an output effort level to an Amazon Bedrock Converse request, it placedeffortinside thethinkingobject. Bedrock expectsthinkingandoutput_configto be sibling fields inadditionalModelRequestFields.Ⅱ. Behavior
For a request containing:
{ "thinking": { "type": "adaptive" }, "output_config": { "effort": "high" } }Before:
{ "thinking": { "type": "adaptive", "effort": "high" } }(output_config lost, effort at wrong nesting level)
After:
{ "thinking": { "type": "adaptive" }, "output_config": { "effort": "high" } }Ⅲ. Changes
provider/bedrock.go— setoutput_config.effortas a sibling ofthinkinginadditionalModelRequestFieldsinstead of nestingeffortinsidethinking.provider/bedrock_thinking_test.go— updated the adaptive-effort test to assert the sibling structure (renamed...IntoThinking→...ToSiblingOutputConfig).Ⅳ. Scope
Supported effort values remain
low/medium/high; unsupported values are still omitted. Manual extended thinking (budget_tokens) and requests without adaptive thinking are unaffected — covered by the existingTestBedrockRequestDropsOutputEffortWithoutAdaptiveThinkingandTestBedrockRequestDropsUnsupportedAdaptiveOutputEfforttests which continue to pass.