Skip to content

Commit 745e2eb

Browse files
committed
refactor: simplify geo prefix detection without hardcoding providers
Model names with geo prefixes have 3+ dot-separated parts, so we can detect them without knowing the provider names.
1 parent 518dae7 commit 745e2eb

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

tests/providers/test_bedrock.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,14 @@ def test_latest_bedrock_model_names_geo_prefixes_are_supported():
128128
"""
129129
model_names = get_args(LatestBedrockModelNames)
130130

131-
# Known providers that appear after the geo prefix
132-
known_providers = ('anthropic', 'amazon', 'meta', 'mistral', 'cohere', 'deepseek')
133-
134131
missing_prefixes: set[str] = set()
135132

136133
for model_name in model_names:
137-
# Check if this model name has a geo prefix by seeing if it has 3+ dot-separated parts
138-
# and the second part is a known provider
134+
# Model names with geo prefixes have 3+ dot-separated parts:
135+
# - No prefix: "anthropic.claude-xxx" (2 parts)
136+
# - With prefix: "us.anthropic.claude-xxx" (3 parts)
139137
parts = model_name.split('.')
140-
if len(parts) >= 3 and parts[1] in known_providers:
141-
# This model has a geo prefix (e.g., "us.anthropic.claude...")
138+
if len(parts) >= 3:
142139
geo_prefix = parts[0] + '.'
143140
if geo_prefix not in BEDROCK_GEO_PREFIXES:
144141
missing_prefixes.add(geo_prefix)

0 commit comments

Comments
 (0)