mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-06 17:57:43 +02:00
[eric] models: add Sonnet 5 to the tier map + picker sorts newest-first within a capability tier (was buried under older Opus by alphabetical family)
This commit is contained in:
@@ -20,6 +20,8 @@ MODEL_TIERS: dict[str, tuple[int, int, int]] = {
|
||||
"claude-opus-4-5": (5, 2, 5),
|
||||
"claude-opus-4": (5, 2, 5),
|
||||
"anthropic/claude-opus-4": (5, 2, 5),
|
||||
"claude-sonnet-5": (5, 4, 3),
|
||||
"anthropic/claude-sonnet-5": (5, 4, 3),
|
||||
"claude-sonnet-4-6": (4, 4, 3),
|
||||
"claude-sonnet-4.6": (4, 4, 3),
|
||||
"anthropic/claude-sonnet-4.6": (4, 4, 3),
|
||||
|
||||
@@ -92,7 +92,7 @@ function modelFamilyKey(label: string): string {
|
||||
.trim();
|
||||
}
|
||||
|
||||
/** Sort: intelligence desc, family asc, version desc, label asc. */
|
||||
/** Sort: intelligence desc, version desc (newest first within a tier), family asc, label asc. */
|
||||
export function sortModelsForPicker<T extends { label: string }>(models: T[]): T[] {
|
||||
const intelOf = (opt: any): number => {
|
||||
if (Array.isArray(opt.tiers) && opt.tiers.length === 3) return opt.tiers[0];
|
||||
@@ -102,12 +102,13 @@ export function sortModelsForPicker<T extends { label: string }>(models: T[]): T
|
||||
const intelA = intelOf(a);
|
||||
const intelB = intelOf(b);
|
||||
if (intelA !== intelB) return intelB - intelA;
|
||||
const famA = modelFamilyKey(a.label);
|
||||
const famB = modelFamilyKey(b.label);
|
||||
if (famA !== famB) return famA.localeCompare(famB);
|
||||
// Version before family: among models of similar capability, the NEWEST goes on top (Sonnet 5 above Opus 4.6, not buried under the alphabetically-earlier "opus" family).
|
||||
const verA = modelVersion(a.label);
|
||||
const verB = modelVersion(b.label);
|
||||
if (verA !== verB) return verB - verA;
|
||||
const famA = modelFamilyKey(a.label);
|
||||
const famB = modelFamilyKey(b.label);
|
||||
if (famA !== famB) return famA.localeCompare(famB);
|
||||
return a.label.localeCompare(b.label);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user