mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-22 16:25:58 +00:00
fix: widen geo-prefix parity to all Bedrock ID normalization sites
The au./apac. additions from #46297 and #65973 covered is_anthropic_bedrock_model and _normalize_bedrock_model_name; the same prefix lists exist at two more sibling sites that would still miss au./ca./sa./me./af. profiles: - anthropic_adapter._looks_like_bedrock_model_id - chat_completion_helpers (reasoning stale-timeout floor resolution) All four sites now share the same 11-prefix set (global/us/eu/apac/ap/ au/jp/ca/sa/me/af, longest-first so apac. wins over ap.). The Bedrock picker's BEDROCK_GEO_PREFIXES is deliberately untouched: au. absent there fails open (profile shown), and adding it requires a region-to-geo remap to avoid hiding Sydney profiles.
This commit is contained in:
parent
487574c5b6
commit
45f8ba0b9b
3 changed files with 12 additions and 3 deletions
|
|
@ -1582,7 +1582,10 @@ def _is_bedrock_model_id(model: str) -> bool:
|
|||
"""
|
||||
lower = model.lower()
|
||||
# Regional inference-profile prefixes
|
||||
if any(lower.startswith(p) for p in ("global.", "us.", "eu.", "ap.", "jp.")):
|
||||
if any(lower.startswith(p) for p in (
|
||||
"global.", "us.", "eu.", "apac.", "ap.", "au.", "jp.",
|
||||
"ca.", "sa.", "me.", "af.",
|
||||
)):
|
||||
return True
|
||||
# Bare Bedrock model IDs: provider.model-family
|
||||
if lower.startswith("anthropic."):
|
||||
|
|
|
|||
|
|
@ -448,7 +448,10 @@ 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.", "apac.", "ap.", "au.", "jp."):
|
||||
for prefix in (
|
||||
"global.", "us.", "eu.", "apac.", "ap.", "au.", "jp.",
|
||||
"ca.", "sa.", "me.", "af.",
|
||||
):
|
||||
if model_lower.startswith(prefix):
|
||||
model_lower = model_lower[len(prefix):]
|
||||
break
|
||||
|
|
|
|||
|
|
@ -341,7 +341,10 @@ def _bedrock_reasoning_stale_floor(model_id: object) -> "float | None":
|
|||
if not model_id or not isinstance(model_id, str):
|
||||
return None
|
||||
name = model_id.strip().lower()
|
||||
for prefix in ("us.", "eu.", "apac.", "ap.", "global.", "jp."):
|
||||
for prefix in (
|
||||
"global.", "us.", "eu.", "apac.", "ap.", "au.", "jp.",
|
||||
"ca.", "sa.", "me.", "af.",
|
||||
):
|
||||
if name.startswith(prefix):
|
||||
name = name[len(prefix):]
|
||||
break
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue