chore(tests): extend env-var migration to additional Bedrock Anthropic live-call sites
Some checks failed
Unit Tests: Caching (Redis) / caching-redis (push) Has been cancelled
Unit Tests: Proxy DB Operations / assert-shard-coverage (push) Has been cancelled
Unit Tests: Security / security (push) Has been cancelled
Unit Tests: Proxy DB Operations / auth-checks (push) Has been cancelled
Unit Tests: Proxy DB Operations / budgets (push) Has been cancelled
Unit Tests: Proxy DB Operations / custom-logging (push) Has been cancelled
Unit Tests: Proxy DB Operations / db-and-spend (push) Has been cancelled
Unit Tests: Proxy DB Operations / endpoints-and-responses (push) Has been cancelled
Unit Tests: Proxy DB Operations / guardrails-hooks (push) Has been cancelled
Unit Tests: Proxy DB Operations / jwt-and-keys (push) Has been cancelled
Unit Tests: Proxy DB Operations / key-generation (push) Has been cancelled
Unit Tests: Proxy DB Operations / logging-misc (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-runtime (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-server-core (push) Has been cancelled
Unit Tests: Proxy DB Operations / schema-migration (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-utils (push) Has been cancelled

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 e10b14a17d. 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
This commit is contained in:
Ryan Crabbe 2026-04-28 22:52:20 -07:00
parent e10b14a17d
commit db40cddc17
No known key found for this signature in database
4 changed files with 8 additions and 8 deletions

View file

@ -475,7 +475,7 @@ def test_bedrock_claude_3(image_url):
],
}
response: ModelResponse = completion(
model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
model=os.environ["BEDROCK_ANTHROPIC_MODEL"],
num_retries=3,
**data,
) # type: ignore
@ -602,7 +602,7 @@ def test_bedrock_claude_3_tool_calling():
}
]
response: ModelResponse = completion(
model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
model=os.environ["BEDROCK_ANTHROPIC_MODEL"],
messages=messages,
tools=tools,
tool_choice="auto",
@ -630,7 +630,7 @@ def test_bedrock_claude_3_tool_calling():
)
# In the second response, Claude should deduce answer from tool results
second_response = completion(
model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
model=os.environ["BEDROCK_ANTHROPIC_MODEL"],
messages=messages,
tools=tools,
tool_choice="auto",
@ -939,7 +939,7 @@ def test_bedrock_tool_calling():
"""
litellm.set_verbose = True
response = litellm.completion(
model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
model=os.environ["BEDROCK_ANTHROPIC_MODEL"],
fallbacks=["bedrock/meta.llama3-1-8b-instruct-v1:0"],
messages=[
{
@ -2887,7 +2887,7 @@ async def test_bedrock_stream_thinking_content_openwebui():
```
"""
response = await litellm.acompletion(
model="bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0",
model=os.environ["BEDROCK_ANTHROPIC_MODEL"],
messages=[{"role": "user", "content": "Hello who is this?"}],
stream=True,
max_tokens=1080,

View file

@ -471,7 +471,7 @@ def test_completion_bedrock_invalid_role_exception():
try:
litellm.set_verbose = True
response = completion(
model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
model=os.environ["BEDROCK_ANTHROPIC_MODEL"],
messages=[{"role": "very-bad-role", "content": "hello"}],
)
print(f"response: {response}")

View file

@ -1241,7 +1241,7 @@ def test_bedrock_claude_3_streaming():
try:
litellm.set_verbose = True
response: ModelResponse = completion( # type: ignore
model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
model=os.environ["BEDROCK_ANTHROPIC_MODEL"],
messages=messages,
max_tokens=10, # type: ignore
stream=True,

View file

@ -24,7 +24,7 @@ async def test_bedrock_sonnet_4_5_with_advanced_tool_use_beta_header():
"""
litellm._turn_on_debug()
response = await litellm.anthropic.messages.acreate(
model="bedrock/invoke/us.anthropic.claude-sonnet-4-5-20250929-v1:0",
model=os.environ["BEDROCK_ANTHROPIC_INVOKE_MODEL"],
messages=[{"role": "user", "content": "What is 2+2?"}],
max_tokens=100,
provider_specific_header={