Skip to content

Commit 2af13f1

Browse files
committed
test(bedrock): upgrade cache TTL e2e model to Claude Sonnet 4.5
Switches the three new TTL integration tests from Claude Haiku 4.5 to Claude Sonnet 4.5 via a _CACHE_TTL_MODEL_ID module constant. Sonnet 4.5 is also officially documented as supporting 1h TTL per https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html and the Sonnet tier typically has a longer support lifecycle than Haiku, reducing the risk of the tests breaking due to model deprecation. Extracting the ID into a module-level constant also makes future model bumps a one-line change.
1 parent 67d081f commit 2af13f1

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

tests_integ/models/test_model_bedrock.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
from strands.models import BedrockModel, CacheConfig
1010
from strands.types.content import ContentBlock
1111

12+
# Model ID used for prompt-caching TTL integration tests. Per
13+
# https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html
14+
# the models that officially support 1h TTL on CachePoint are
15+
# Claude Opus 4.5, Claude Haiku 4.5, and Claude Sonnet 4.5. Using Sonnet 4.5
16+
# here for longer expected support lifecycle than Haiku.
17+
_CACHE_TTL_MODEL_ID = "us.anthropic.claude-sonnet-4-5-20250929-v1:0"
18+
1219

1320
@pytest.fixture
1421
def system_prompt():
@@ -589,10 +596,12 @@ def test_prompt_caching_cache_tools_ttl():
589596
prefix because Bedrock's tool-prefix cache threshold varies by model and region.
590597
The critical behavior under test here is that the TTL field is accepted end-to-end.
591598
592-
Uses Claude Haiku 4.5 which supports TTL in CachePointBlock on Bedrock.
599+
Uses Claude Sonnet 4.5 which supports TTL in CachePointBlock on Bedrock per
600+
https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html
601+
(Claude Opus 4.5, Claude Haiku 4.5, and Claude Sonnet 4.5 all support 1h TTL).
593602
"""
594603
model = BedrockModel(
595-
model_id="us.anthropic.claude-haiku-4-5-20251001-v1:0",
604+
model_id=_CACHE_TTL_MODEL_ID,
596605
streaming=False,
597606
cache_tools="default",
598607
cache_tools_ttl="5m",
@@ -624,10 +633,11 @@ def test_prompt_caching_cache_config_auto_with_ttl():
624633
Verifies that the cache point appended to the last user message by _inject_cache_point
625634
carries the configured TTL, and that Bedrock accepts the request.
626635
627-
Uses Claude Haiku 4.5 which supports TTL in CachePointBlock on Bedrock.
636+
Uses Claude Sonnet 4.5 which supports TTL in CachePointBlock on Bedrock per
637+
https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html
628638
"""
629639
model = BedrockModel(
630-
model_id="us.anthropic.claude-haiku-4-5-20251001-v1:0",
640+
model_id=_CACHE_TTL_MODEL_ID,
631641
streaming=False,
632642
cache_config=CacheConfig(strategy="auto", ttl="5m"),
633643
)
@@ -662,10 +672,11 @@ def test_prompt_caching_aligned_1h_ttl_across_checkpoints():
662672
This test sets 1h TTL on all three checkpoints simultaneously and verifies the
663673
call succeeds.
664674
665-
Uses Claude Haiku 4.5 which supports 1h TTL.
675+
Uses Claude Sonnet 4.5 which supports 1h TTL per
676+
https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html
666677
"""
667678
model = BedrockModel(
668-
model_id="us.anthropic.claude-haiku-4-5-20251001-v1:0",
679+
model_id=_CACHE_TTL_MODEL_ID,
669680
streaming=False,
670681
cache_tools="default",
671682
cache_tools_ttl="1h",

0 commit comments

Comments
 (0)