fix(model-capabilities): align gemini aliases and alias lookup
This commit is contained in:
@@ -27,8 +27,8 @@ describe("getModelCapabilities", () => {
|
|||||||
},
|
},
|
||||||
toolCall: true,
|
toolCall: true,
|
||||||
},
|
},
|
||||||
"gemini-3.1-pro-preview": {
|
"gemini-3.1-pro": {
|
||||||
id: "gemini-3.1-pro-preview",
|
id: "gemini-3.1-pro",
|
||||||
family: "gemini",
|
family: "gemini",
|
||||||
reasoning: true,
|
reasoning: true,
|
||||||
temperature: true,
|
temperature: true,
|
||||||
@@ -193,7 +193,7 @@ describe("getModelCapabilities", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
expect(result).toMatchObject({
|
expect(result).toMatchObject({
|
||||||
canonicalModelID: "gemini-3.1-pro-preview",
|
canonicalModelID: "gemini-3.1-pro",
|
||||||
family: "gemini",
|
family: "gemini",
|
||||||
supportsThinking: true,
|
supportsThinking: true,
|
||||||
supportsTemperature: true,
|
supportsTemperature: true,
|
||||||
|
|||||||
@@ -18,12 +18,22 @@ describe("model-capability-aliases", () => {
|
|||||||
|
|
||||||
expect(result).toEqual({
|
expect(result).toEqual({
|
||||||
requestedModelID: "gemini-3.1-pro-high",
|
requestedModelID: "gemini-3.1-pro-high",
|
||||||
canonicalModelID: "gemini-3.1-pro-preview",
|
canonicalModelID: "gemini-3.1-pro",
|
||||||
source: "exact-alias",
|
source: "exact-alias",
|
||||||
ruleID: "gemini-3.1-pro-tier-alias",
|
ruleID: "gemini-3.1-pro-tier-alias",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("does not resolve prototype keys as aliases", () => {
|
||||||
|
const result = resolveModelIDAlias("constructor")
|
||||||
|
|
||||||
|
expect(result).toEqual({
|
||||||
|
requestedModelID: "constructor",
|
||||||
|
canonicalModelID: "constructor",
|
||||||
|
source: "canonical",
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
test("normalizes legacy Claude thinking aliases through a named exact rule", () => {
|
test("normalizes legacy Claude thinking aliases through a named exact rule", () => {
|
||||||
const result = resolveModelIDAlias("claude-opus-4-6-thinking")
|
const result = resolveModelIDAlias("claude-opus-4-6-thinking")
|
||||||
|
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ const EXACT_ALIAS_RULES: ReadonlyArray<ExactAliasRule> = [
|
|||||||
{
|
{
|
||||||
aliasModelID: "gemini-3.1-pro-high",
|
aliasModelID: "gemini-3.1-pro-high",
|
||||||
ruleID: "gemini-3.1-pro-tier-alias",
|
ruleID: "gemini-3.1-pro-tier-alias",
|
||||||
canonicalModelID: "gemini-3.1-pro-preview",
|
canonicalModelID: "gemini-3.1-pro",
|
||||||
rationale: "OmO historically encoded Gemini tier selection in the model name instead of variant metadata.",
|
rationale: "OmO historically encoded Gemini tier selection in the model name instead of variant metadata.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
aliasModelID: "gemini-3.1-pro-low",
|
aliasModelID: "gemini-3.1-pro-low",
|
||||||
ruleID: "gemini-3.1-pro-tier-alias",
|
ruleID: "gemini-3.1-pro-tier-alias",
|
||||||
canonicalModelID: "gemini-3.1-pro-preview",
|
canonicalModelID: "gemini-3.1-pro",
|
||||||
rationale: "OmO historically encoded Gemini tier selection in the model name instead of variant metadata.",
|
rationale: "OmO historically encoded Gemini tier selection in the model name instead of variant metadata.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ const EXACT_ALIAS_RULES: ReadonlyArray<ExactAliasRule> = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const EXACT_ALIAS_RULES_BY_MODEL: Readonly<Record<string, ExactAliasRule>> = Object.fromEntries(
|
const EXACT_ALIAS_RULES_BY_MODEL: ReadonlyMap<string, ExactAliasRule> = new Map(
|
||||||
EXACT_ALIAS_RULES.map((rule) => [rule.aliasModelID, rule]),
|
EXACT_ALIAS_RULES.map((rule) => [rule.aliasModelID, rule]),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ function normalizeLookupModelID(modelID: string): string {
|
|||||||
|
|
||||||
export function resolveModelIDAlias(modelID: string): ModelIDAliasResolution {
|
export function resolveModelIDAlias(modelID: string): ModelIDAliasResolution {
|
||||||
const normalizedModelID = normalizeLookupModelID(modelID)
|
const normalizedModelID = normalizeLookupModelID(modelID)
|
||||||
const exactRule = EXACT_ALIAS_RULES_BY_MODEL[normalizedModelID]
|
const exactRule = EXACT_ALIAS_RULES_BY_MODEL.get(normalizedModelID)
|
||||||
if (exactRule) {
|
if (exactRule) {
|
||||||
return {
|
return {
|
||||||
requestedModelID: normalizedModelID,
|
requestedModelID: normalizedModelID,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ describe("model-capability-guardrails", () => {
|
|||||||
const brokenSnapshot: ModelCapabilitiesSnapshot = {
|
const brokenSnapshot: ModelCapabilitiesSnapshot = {
|
||||||
...bundledSnapshot,
|
...bundledSnapshot,
|
||||||
models: Object.fromEntries(
|
models: Object.fromEntries(
|
||||||
Object.entries(bundledSnapshot.models).filter(([modelID]) => modelID !== "gemini-3.1-pro-preview"),
|
Object.entries(bundledSnapshot.models).filter(([modelID]) => modelID !== "gemini-3.1-pro"),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ describe("model-capability-guardrails", () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
kind: "alias-target-missing-from-snapshot",
|
kind: "alias-target-missing-from-snapshot",
|
||||||
aliasModelID: "gemini-3.1-pro-high",
|
aliasModelID: "gemini-3.1-pro-high",
|
||||||
canonicalModelID: "gemini-3.1-pro-preview",
|
canonicalModelID: "gemini-3.1-pro",
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@@ -70,7 +70,7 @@ describe("model-capability-guardrails", () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
kind: "exact-alias-collides-with-snapshot",
|
kind: "exact-alias-collides-with-snapshot",
|
||||||
aliasModelID: "gemini-3.1-pro-high",
|
aliasModelID: "gemini-3.1-pro-high",
|
||||||
canonicalModelID: "gemini-3.1-pro-preview",
|
canonicalModelID: "gemini-3.1-pro",
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@@ -84,7 +84,7 @@ describe("model-capability-guardrails", () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
kind: "built-in-model-relies-on-alias",
|
kind: "built-in-model-relies-on-alias",
|
||||||
modelID: "gemini-3.1-pro-high",
|
modelID: "gemini-3.1-pro-high",
|
||||||
canonicalModelID: "gemini-3.1-pro-preview",
|
canonicalModelID: "gemini-3.1-pro",
|
||||||
ruleID: "gemini-3.1-pro-tier-alias",
|
ruleID: "gemini-3.1-pro-tier-alias",
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user