fix(tests): replace deprecated Bedrock Claude 3.7 Sonnet model ID - #26721
Conversation
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 SummaryThis PR replaces the EOL Bedrock model ID Confidence Score: 4/5Safe 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.
|
| 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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
…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
…bedrock-model fix(tests): replace deprecated Bedrock Claude 3.7 Sonnet model ID
Summary
claude-3-7-sonnet-20250219-v1:0(returns 404 with "This model version has reached the end of its life."), breaking the livetest_aaparallel_function_call_with_anthropic_thinkingtest.claude-sonnet-4-5-20250929-v1:0across 16 test files. Same capability surface (thinking, tools, prompt caching, PDF input, vision, computer use).Test plan
make test-uniton touched files passes locallytest_aaparallel_function_call_with_anthropic_thinking[bedrock/...]andTestBedrockInvokePromptCachingtests