Skip to content

fix(tests): replace deprecated Bedrock Claude 3.7 Sonnet model ID - #26721

Merged
yuneng-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_fix-deprecated-bedrock-model
Apr 28, 2026
Merged

fix(tests): replace deprecated Bedrock Claude 3.7 Sonnet model ID#26721
yuneng-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_fix-deprecated-bedrock-model

Conversation

@ryan-crabbe-berri

@ryan-crabbe-berri ryan-crabbe-berri commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • AWS Bedrock has reached end-of-life for claude-3-7-sonnet-20250219-v1:0 (returns 404 with "This model version has reached the end of its life."), breaking the live test_aaparallel_function_call_with_anthropic_thinking test.
  • Replace test references with claude-sonnet-4-5-20250929-v1:0 across 16 test files. Same capability surface (thinking, tools, prompt caching, PDF input, vision, computer use).

Test plan

  • make test-unit on touched files passes locally
  • CI passes, including the previously failing test_aaparallel_function_call_with_anthropic_thinking[bedrock/...] and TestBedrockInvokePromptCaching tests

AWS Bedrock has reached end-of-life for `claude-3-7-sonnet-20250219-v1:0`,
returning 404s with "This model version has reached the end of its life."
Update test references to `claude-sonnet-4-5-20250929-v1:0` (same capability
surface: thinking, tools, prompt caching, PDF input, vision, computer use).

The bedrock/invoke pass-through tests stay on Sonnet 3.5 since Sonnet 4.5
is converse-only on Bedrock.
@greptile-apps

greptile-apps Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR replaces the EOL Bedrock model ID anthropic.claude-3-7-sonnet-20250219-v1:0 with anthropic.claude-sonnet-4-5-20250929-v1:0 across 16 test files, fixing the broken test_aaparallel_function_call_with_anthropic_thinking live test. The swap is correctly applied across mocked unit tests, fixture data, and live integration tests — except for one case where the invoke-path E2E test was also changed to Sonnet 4.5, contradicting the PR's own stated constraint that invoke tests must stay on a model that supports bedrock/invoke/.

Confidence Score: 4/5

Safe to merge after fixing the invoke-path E2E test model ID; all other changes are correct model ID substitutions.

One P1 finding: TestBedrockInvokePromptCaching uses a converse-only model with the invoke path, directly contradicting the PR's own stated constraint. The base class confirms these are E2E tests making real API calls, so the test will fail if run against the live endpoint. All other 15 files are straightforward, correct substitutions.

tests/pass_through_unit_tests/test_anthropic_messages_prompt_caching.py — TestBedrockInvokePromptCaching needs a converse-compatible model ID (e.g. claude-3-5-sonnet-20241022-v2:0) for the invoke path.

Important Files Changed

Filename Overview
tests/pass_through_unit_tests/test_anthropic_messages_prompt_caching.py Both converse and invoke subclasses updated to Sonnet 4.5, but invoke path is incompatible with Sonnet 4.5 on Bedrock (converse-only); E2E tests will fail when run live.
tests/local_testing/test_function_calling.py Live parallel function-call test now targets Sonnet 4.5 which supports tools; this is the primary test the PR fixes.
tests/test_litellm/test_utils.py 14 occurrences replaced across computer-use, proxy function-calling, and bedrock_models lists; straightforward model ID swap.
tests/test_litellm/integrations/test_anthropic_cache_control_hook.py All 9 occurrences of the old model ID replaced; tests are fully mocked so the change is safe.
tests/test_litellm/integrations/open_telemetry/data/captured_kwargs.json Fixture regenerated: model ID, ARN URLs, and litellm_model_name updated; model_group name ("claude-3-7-sonnet") intentionally retained as it reflects proxy routing config.
tests/litellm_utils_tests/test_utils.py Test renamed and parametrize values updated to Sonnet 4.5; drops coverage of deprecated model's PDF-support capability (noted in previous review comments).

Reviews (2): Last reviewed commit: "fix(tests): use Sonnet 4.5 for Bedrock i..." | Re-trigger Greptile

Claude 3.5 Sonnet v2 reached EOL on Bedrock 2026-03-01, returning the same
404 EOL error as 3.7 Sonnet. Sonnet 4.5 supports both InvokeModel and
Converse APIs on Bedrock, so use the same model for both routes.
@codecov

codecov Bot commented Apr 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@yuneng-berri
yuneng-berri merged commit 89f0d40 into litellm_internal_staging Apr 28, 2026
116 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_fix-deprecated-bedrock-model branch April 28, 2026 23:23
ryan-crabbe-berri added a commit that referenced this pull request Apr 29, 2026
Replace hardcoded Bedrock Anthropic model IDs in 2 live test files with
required env vars set in CircleCI project env vars. Future AWS EOLs of
Bedrock Anthropic models become CircleCI UI value bumps — no PR, no
multi-file code edit (cf. PR #26721 which had to touch 16 files).

Three env vars, one per route prefix, each holding a full copy-pasteable
model path:

  BEDROCK_ANTHROPIC_MODEL          → bedrock/<id>           (default route)
  BEDROCK_ANTHROPIC_CONVERSE_MODEL → bedrock/converse/<id>  (explicit converse)
  BEDROCK_ANTHROPIC_INVOKE_MODEL   → bedrock/invoke/<id>    (explicit invoke)

Test code is os.environ[...] with no concatenation. No in-code fallback
default — files fail loud at collection (KeyError) if any env var is
missing. This avoids the dead-code trap of unused fallbacks (cf.
existing precedents BEDROCK_TEST_MODEL, LITELLM_PROXY_RESPONSES_MODEL
which silently default forever because their env vars were never set).

Scope is limited to live tests only:
  - tests/local_testing/test_function_calling.py
  - tests/pass_through_unit_tests/test_anthropic_messages_prompt_caching.py

Mocked transformation tests intentionally keep their hardcoded IDs —
the model string is opaque there and never reaches AWS.

Pre-merge: all 3 env vars must be set in CircleCI UI.
ryan-crabbe-berri added a commit that referenced this pull request Apr 29, 2026
…c live-call sites

Migrate 8 additional sonnet-routed live test call sites to read the model
path from the existing `BEDROCK_ANTHROPIC_MODEL` / `BEDROCK_ANTHROPIC_INVOKE_MODEL`
env vars introduced in e10b14a. Future Anthropic-on-Bedrock EOL bumps now
take fewer file edits than they did under PR #26721.

Sites (4 files):
  tests/llm_translation/test_bedrock_completion.py
    478, 605, 633, 942, 2890   bedrock/<id>             → BEDROCK_ANTHROPIC_MODEL
  tests/local_testing/test_exceptions.py
    474                         bedrock/<id>             → BEDROCK_ANTHROPIC_MODEL
  tests/local_testing/test_streaming.py
    1244                        bedrock/<id>             → BEDROCK_ANTHROPIC_MODEL
  tests/pass_through_unit_tests/test_bedrock_tool_use_beta_header.py
    27                          bedrock/invoke/<id>      → BEDROCK_ANTHROPIC_INVOKE_MODEL

Route prefix is preserved at every site (no cross-routing).

Deliberately not migrated:
  - haiku-pinned tests (env vars resolve to sonnet) — see test_bedrock_completion.py
    haiku sites and tests/local_testing/test_timeout.py:79
  - test_bedrock_govcloud.py — uses completion_cost(), pure utility, never hits AWS
  - test_bedrock_completion.py:2038 (_transform_request), 2526 (decoder), 664
    (@pytest.mark.skip)
  - test_bedrock_completion.py:3145, 3152, 3247, 3300, 3352 — passthrough tests
    with hardcoded `endpoint=` alongside `model=`; would need a 4th env var or
    string-derivation
  - test_bedrock_anthropic_messages_test.py and test_websearch_interception_e2e.py
    — multi-site router-config refactors; deferred
  - all tests/test_litellm/* — strict unit / mocked transformation tests; the
    hardcoded model string never reaches AWS so EOLs don't break them
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…bedrock-model

fix(tests): replace deprecated Bedrock Claude 3.7 Sonnet model ID
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.

2 participants