Merge pull request #891 from NousResearch/hermes/hermes-b0162f8d

fix: sort Nous Portal model list (opus first, sonnet lower)
This commit is contained in:
Teknium 2026-03-10 23:21:01 -07:00 committed by GitHub
commit a35c37a2f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1103,6 +1103,19 @@ def fetch_nous_models(
continue
model_ids.append(mid)
# Sort: prefer opus > pro > haiku/flash > sonnet (sonnet is cheap/fast,
# users who want the best model should see opus first).
def _model_priority(mid: str) -> tuple:
low = mid.lower()
if "opus" in low:
return (0, mid)
if "pro" in low and "sonnet" not in low:
return (1, mid)
if "sonnet" in low:
return (3, mid)
return (2, mid)
model_ids.sort(key=_model_priority)
return list(dict.fromkeys(model_ids))