fix(bedrock): recognise au./apac. inference profiles to enable prompt caching

is_anthropic_bedrock_model() strips a regional prefix before checking for
"anthropic.claude" to route Claude through the AnthropicBedrock SDK path
(prompt caching, thinking budgets) instead of the Converse path. The prefix
list was missing "au." and "ap." does not match "apac.", so AU/APAC Claude
inference profiles silently lost prompt caching. Add "apac." and "au.".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jake Tracey 2026-06-15 05:52:11 +10:00 committed by Teknium
parent a1813c1ef4
commit 4e4904c379
2 changed files with 10 additions and 1 deletions

View file

@ -448,7 +448,7 @@ def is_anthropic_bedrock_model(model_id: str) -> bool:
"""
model_lower = model_id.lower()
# Strip regional prefix if present
for prefix in ("us.", "global.", "eu.", "ap.", "jp."):
for prefix in ("us.", "global.", "eu.", "apac.", "ap.", "au.", "jp."):
if model_lower.startswith(prefix):
model_lower = model_lower[len(prefix):]
break

View file

@ -1330,6 +1330,15 @@ class TestIsAnthropicBedrockModel:
from agent.bedrock_adapter import is_anthropic_bedrock_model
assert is_anthropic_bedrock_model("eu.anthropic.claude-sonnet-4-6") is True
def test_au_inference_profile(self):
from agent.bedrock_adapter import is_anthropic_bedrock_model
assert is_anthropic_bedrock_model("au.anthropic.claude-haiku-4-5-20251001-v1:0") is True
assert is_anthropic_bedrock_model("au.anthropic.claude-sonnet-4-6") is True
def test_apac_inference_profile(self):
from agent.bedrock_adapter import is_anthropic_bedrock_model
assert is_anthropic_bedrock_model("apac.anthropic.claude-sonnet-4-6") is True
class TestEmptyTextBlockFix:
"""Test that empty/whitespace-only text blocks are replaced with a