mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-15 23:31:29 +00:00
chore(tests): source bedrock anthropic live test models from env vars
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.
This commit is contained in:
parent
f2747e8c75
commit
e10b14a17d
2 changed files with 8 additions and 3 deletions
|
|
@ -155,11 +155,13 @@ def test_aaparallel_function_call(model):
|
||||||
# test_parallel_function_call()
|
# 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(
|
@pytest.mark.parametrize(
|
||||||
"model",
|
"model",
|
||||||
[
|
[
|
||||||
"anthropic/claude-4-sonnet-20250514",
|
"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)
|
@pytest.mark.flaky(retries=3, delay=1)
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,9 @@ from base_anthropic_messages_prompt_caching_test import (
|
||||||
BaseAnthropicMessagesPromptCachingTest,
|
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):
|
class TestBedrockConversePromptCaching(BaseAnthropicMessagesPromptCachingTest):
|
||||||
"""
|
"""
|
||||||
|
|
@ -31,7 +34,7 @@ class TestBedrockConversePromptCaching(BaseAnthropicMessagesPromptCachingTest):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def get_model(self) -> str:
|
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):
|
class TestBedrockInvokePromptCaching(BaseAnthropicMessagesPromptCachingTest):
|
||||||
|
|
@ -43,4 +46,4 @@ class TestBedrockInvokePromptCaching(BaseAnthropicMessagesPromptCachingTest):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def get_model(self) -> str:
|
def get_model(self) -> str:
|
||||||
return "bedrock/invoke/us.anthropic.claude-sonnet-4-5-20250929-v1:0"
|
return os.environ["BEDROCK_ANTHROPIC_INVOKE_MODEL"]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue