Skip to content

fix(bedrock): strip output_config from Converse requests; fix spend tracking redaction test - #23240

Merged
Sameerlite merged 1 commit into
mainfrom
litellm_bedrock-nova-output-config-spend-tracking
Mar 10, 2026
Merged

fix(bedrock): strip output_config from Converse requests; fix spend tracking redaction test#23240
Sameerlite merged 1 commit into
mainfrom
litellm_bedrock-nova-output-config-spend-tracking

Conversation

@Sameerlite

Copy link
Copy Markdown
Contributor

Summary

  • Strip output_config (snake_case) from Bedrock Converse requests — Nova and other Converse models reject this Anthropic-only param
  • Fix test_spend_logs_redacts_request_and_response_when_turn_off_message_logging_enabled to match actual perform_redaction behavior (in-place content redaction)

Changes

  • converse_transformation.py: pop output_config before building request
  • test_converse_transformation.py: add test_output_config_snake_case_stripped_from_bedrock_converse_request
  • test_spend_tracking_utils.py: update assertion for dict response redaction

Made with Cursor

@vercel

vercel Bot commented Mar 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Error Error Mar 10, 2026 6:25am

Request Review

@greptile-apps

greptile-apps Bot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR contains two focused bug fixes:

  1. output_config leaking into Bedrock Converse requests – When the Anthropic-style snake_case output_config parameter is passed (either by users or internal param-mapping code), it was not being stripped and ended up in additionalModelRequestFields, causing Nova and other non-Claude Converse models to reject the request. The one-line fix pops output_config unconditionally before the supported/unsupported parameter split, mirroring how the camelCase outputConfig is already handled just above it.

  2. Incorrect spend-log redaction test assertion – The pre-existing test asserted that the redacted response would equal {"text": "redacted-by-litellm"}, but perform_redaction actually mutates the response in-place and leaves the full choices structure intact, with only message.content replaced. The updated assertions match the actual behaviour.

Key observations:

  • The production change is a single, unconditional pop — it is applied to all Bedrock Converse requests, which is correct because output_config (snake_case) is Anthropic-specific and has no Bedrock Converse equivalent; the Bedrock-native outputConfig path is unaffected.
  • All new tests are mock-only, consistent with repository conventions.
  • No model-specific flags are hardcoded in production code; the strip is applied universally.

Confidence Score: 5/5

  • This PR is safe to merge; both changes are minimal, well-scoped bug fixes with accompanying tests.
  • The production change is a single unconditional pop that removes a parameter known to break non-Claude Bedrock models. The test fix aligns an incorrect assertion with observed behaviour. No backwards-incompatible API surface changes, no new dependencies, no real network calls in tests.
  • No files require special attention.

Last reviewed commit: 200b001

@Sameerlite
Sameerlite merged commit f33f446 into main Mar 10, 2026
88 of 98 checks passed
Chesars added a commit that referenced this pull request Mar 12, 2026
Restore independent fixes from main that were collaterally removed
when PR #23276 (staging_03_10 → main) carried a revert commit:
- bedrock: restore output_config pop (PR #23240)
- redact_messages: restore dict handling for ModelResponse (PR #23235)
- model_checks: restore list() copies to avoid cache mutation (PR #23236)
- openapi_to_mcp_generator: restore relative URL handling (PR #23238)
- vertex_ai/gemini: restore _LITELLM_INTERNAL_EXTRA_BODY_KEYS check (PR #23131)
- openai types: restore extra finish reasons (PR #22138)
- completion_extras: restore usage transformation logic

Accept main for: model_prices JSONs, credential_endpoints,
team_endpoints, object_permission_utils, responses transformation.
@ishaan-berri
ishaan-berri deleted the litellm_bedrock-nova-output-config-spend-tracking branch March 26, 2026 22:29
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…tput-config-spend-tracking

fix(bedrock): strip output_config from Converse requests; fix spend tracking redaction test
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
Restore independent fixes from main that were collaterally removed
when PR BerriAI#23276 (staging_03_10 → main) carried a revert commit:
- bedrock: restore output_config pop (PR BerriAI#23240)
- redact_messages: restore dict handling for ModelResponse (PR BerriAI#23235)
- model_checks: restore list() copies to avoid cache mutation (PR BerriAI#23236)
- openapi_to_mcp_generator: restore relative URL handling (PR BerriAI#23238)
- vertex_ai/gemini: restore _LITELLM_INTERNAL_EXTRA_BODY_KEYS check (PR BerriAI#23131)
- openai types: restore extra finish reasons (PR BerriAI#22138)
- completion_extras: restore usage transformation logic

Accept main for: model_prices JSONs, credential_endpoints,
team_endpoints, object_permission_utils, responses transformation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant