From e10b14a17de06eef847de3ab990009a5c4db0bd7 Mon Sep 17 00:00:00 2001 From: Ryan Crabbe Date: Tue, 28 Apr 2026 17:37:35 -0700 Subject: [PATCH] chore(tests): source bedrock anthropic live test models from env vars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/ (default route) BEDROCK_ANTHROPIC_CONVERSE_MODEL → bedrock/converse/ (explicit converse) BEDROCK_ANTHROPIC_INVOKE_MODEL → bedrock/invoke/ (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. --- tests/local_testing/test_function_calling.py | 4 +++- .../test_anthropic_messages_prompt_caching.py | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/local_testing/test_function_calling.py b/tests/local_testing/test_function_calling.py index 02affa1d57c..da1301f2c73 100644 --- a/tests/local_testing/test_function_calling.py +++ b/tests/local_testing/test_function_calling.py @@ -155,11 +155,13 @@ def test_aaparallel_function_call(model): # test_parallel_function_call() +# $BEDROCK_ANTHROPIC_MODEL holds the full bedrock-prefixed model path, set in +# CircleCI project env vars. EOL bumps are a CI UI change. Required to be set. @pytest.mark.parametrize( "model", [ "anthropic/claude-4-sonnet-20250514", - "bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0", + os.environ["BEDROCK_ANTHROPIC_MODEL"], ], ) @pytest.mark.flaky(retries=3, delay=1) diff --git a/tests/pass_through_unit_tests/test_anthropic_messages_prompt_caching.py b/tests/pass_through_unit_tests/test_anthropic_messages_prompt_caching.py index a194ded12fd..c6ea5bed2c8 100644 --- a/tests/pass_through_unit_tests/test_anthropic_messages_prompt_caching.py +++ b/tests/pass_through_unit_tests/test_anthropic_messages_prompt_caching.py @@ -21,6 +21,9 @@ from base_anthropic_messages_prompt_caching_test import ( BaseAnthropicMessagesPromptCachingTest, ) +# $BEDROCK_ANTHROPIC_{CONVERSE,INVOKE}_MODEL hold the full route-prefixed +# model paths, set in CircleCI project env vars. EOL bumps are a CI UI change. + class TestBedrockConversePromptCaching(BaseAnthropicMessagesPromptCachingTest): """ @@ -31,7 +34,7 @@ class TestBedrockConversePromptCaching(BaseAnthropicMessagesPromptCachingTest): """ def get_model(self) -> str: - return "bedrock/converse/us.anthropic.claude-sonnet-4-5-20250929-v1:0" + return os.environ["BEDROCK_ANTHROPIC_CONVERSE_MODEL"] class TestBedrockInvokePromptCaching(BaseAnthropicMessagesPromptCachingTest): @@ -43,4 +46,4 @@ class TestBedrockInvokePromptCaching(BaseAnthropicMessagesPromptCachingTest): """ def get_model(self) -> str: - return "bedrock/invoke/us.anthropic.claude-sonnet-4-5-20250929-v1:0" + return os.environ["BEDROCK_ANTHROPIC_INVOKE_MODEL"]