Update default auto routing (#27071)

This commit is contained in:
David Pierce
2026-05-26 14:31:07 +00:00
committed by GitHub
parent 630ecc21b9
commit 4a5d5cfc9f
36 changed files with 321 additions and 428 deletions
@@ -28,7 +28,6 @@ describe('policyCatalog', () => {
const chain = getModelPolicyChain({
previewEnabled: true,
useGemini31: true,
useGemini31FlashLite: false,
});
expect(chain[0]?.model).toBe(PREVIEW_GEMINI_3_1_MODEL);
expect(chain).toHaveLength(2);
@@ -39,7 +38,6 @@ describe('policyCatalog', () => {
const chain = getModelPolicyChain({
previewEnabled: true,
useGemini31: true,
useGemini31FlashLite: false,
useCustomToolModel: true,
});
expect(chain[0]?.model).toBe(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL);
@@ -93,7 +93,6 @@ export function getModelPolicyChain(
const proModel = resolveModel(
PREVIEW_GEMINI_MODEL,
options.useGemini31,
options.useGemini31FlashLite,
options.useCustomToolModel,
);
return [
@@ -30,7 +30,6 @@ const createMockConfig = (overrides: Partial<Config> = {}): Config => {
getUserTier: () => undefined,
getModel: () => 'gemini-2.5-pro',
getGemini31LaunchedSync: () => false,
getGemini31FlashLiteLaunchedSync: () => false,
getUseCustomToolModelSync: () => {
const useGemini31 = config.getGemini31LaunchedSync();
const authType = config.getContentGeneratorConfig().authType;
@@ -114,7 +113,7 @@ describe('policyHelpers', () => {
});
const chain = resolvePolicyChain(config, DEFAULT_GEMINI_FLASH_LITE_MODEL);
expect(chain).toHaveLength(3);
expect(chain[0]?.model).toBe('gemini-2.5-flash-lite');
expect(chain[0]?.model).toBe('gemini-3.1-flash-lite');
expect(chain[1]?.model).toBe('gemini-2.5-flash');
expect(chain[2]?.model).toBe('gemini-2.5-pro');
});
@@ -125,7 +124,7 @@ describe('policyHelpers', () => {
});
const chain = resolvePolicyChain(config);
expect(chain).toHaveLength(3);
expect(chain[0]?.model).toBe('gemini-2.5-flash-lite');
expect(chain[0]?.model).toBe('gemini-3.1-flash-lite');
expect(chain[1]?.model).toBe('gemini-2.5-flash');
expect(chain[2]?.model).toBe('gemini-2.5-pro');
});
@@ -227,7 +226,6 @@ describe('policyHelpers', () => {
getExperimentalDynamicModelConfiguration: () => dynamic,
getModel: () => model,
getGemini31LaunchedSync: () => useGemini31 ?? false,
getGemini31FlashLiteLaunchedSync: () => false,
getHasAccessToPreviewModel: () => hasAccess ?? true,
getContentGeneratorConfig: () => ({ authType }),
getReleaseChannel: () => 'preview',
@@ -52,8 +52,6 @@ export function resolvePolicyChain(
let chain: ModelPolicyChain | undefined;
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
const useGemini31FlashLite =
config.getGemini31FlashLiteLaunchedSync?.() ?? false;
const useCustomToolModel = config.getUseCustomToolModelSync?.() ?? false;
const hasAccessToPreview = config.getHasAccessToPreviewModel?.() ?? false;
@@ -64,7 +62,6 @@ export function resolvePolicyChain(
resolveModel(
modelFromConfig,
useGemini31,
useGemini31FlashLite,
useCustomToolModel,
hasAccessToPreview,
config,
@@ -84,7 +81,6 @@ export function resolvePolicyChain(
if (config.getExperimentalDynamicModelConfiguration?.() === true) {
const context = {
useGemini3_1: useGemini31,
useGemini3_1FlashLite: useGemini31FlashLite,
useCustomTools: useCustomToolModel,
};
@@ -139,7 +135,6 @@ export function resolvePolicyChain(
isAutoSelection,
userTier: config.getUserTier(),
useGemini31,
useGemini31FlashLite,
useCustomToolModel,
});
} else {
@@ -150,7 +145,6 @@ export function resolvePolicyChain(
isAutoSelection,
userTier: config.getUserTier(),
useGemini31,
useGemini31FlashLite,
useCustomToolModel,
});
}
@@ -18,7 +18,6 @@ export const ExperimentFlags = {
MASKING_PROTECT_LATEST_TURN: 45758819,
GEMINI_3_1_PRO_LAUNCHED: 45760185,
PRO_MODEL_NO_ACCESS: 45768879,
GEMINI_3_1_FLASH_LITE_LAUNCHED: 45771641,
DEFAULT_REQUEST_TIMEOUT: 45773134,
} as const;
-14
View File
@@ -716,20 +716,6 @@ describe('Server Config (config.ts)', () => {
});
});
describe('getGemini31FlashLiteLaunchedSync', () => {
it.each([AuthType.USE_GEMINI, AuthType.USE_VERTEX_AI, AuthType.GATEWAY])(
'should return true for %s',
async (authType) => {
const config = new Config(baseParams);
vi.mocked(createContentGeneratorConfig).mockResolvedValue({
authType,
});
await config.refreshAuth(authType);
expect(config.getGemini31FlashLiteLaunchedSync()).toBe(true);
},
);
});
describe('getProModelNoAccessSync', () => {
it('should return experiment value for AuthType.LOGIN_WITH_GOOGLE', async () => {
vi.mocked(getExperiments).mockResolvedValue({
-31
View File
@@ -2051,7 +2051,6 @@ export class Config implements McpContext, AgentLoopContext {
const primaryModel = resolveModel(
model,
this.getGemini31LaunchedSync(),
this.getGemini31FlashLiteLaunchedSync(),
this.getUseCustomToolModelSync(),
this.getHasAccessToPreviewModel(),
this,
@@ -2091,7 +2090,6 @@ export class Config implements McpContext, AgentLoopContext {
const primaryModel = resolveModel(
this.getModel(),
this.getGemini31LaunchedSync(),
this.getGemini31FlashLiteLaunchedSync(),
this.getUseCustomToolModelSync(),
this.getHasAccessToPreviewModel(),
this,
@@ -2107,7 +2105,6 @@ export class Config implements McpContext, AgentLoopContext {
const primaryModel = resolveModel(
this.getModel(),
this.getGemini31LaunchedSync(),
this.getGemini31FlashLiteLaunchedSync(),
this.getUseCustomToolModelSync(),
this.getHasAccessToPreviewModel(),
this,
@@ -2123,7 +2120,6 @@ export class Config implements McpContext, AgentLoopContext {
const primaryModel = resolveModel(
this.getModel(),
this.getGemini31LaunchedSync(),
this.getGemini31FlashLiteLaunchedSync(),
this.getUseCustomToolModelSync(),
this.getHasAccessToPreviewModel(),
this,
@@ -3513,15 +3509,6 @@ export class Config implements McpContext, AgentLoopContext {
return this.getGemini31LaunchedSync();
}
/**
* Returns whether Gemini 3.1 Flash Lite has been launched.
* This method is async and ensures that experiments are loaded before returning the result.
*/
async getGemini31FlashLiteLaunched(): Promise<boolean> {
await this.ensureExperimentsLoaded();
return this.getGemini31FlashLiteLaunchedSync();
}
/**
* Returns whether the custom tool model should be used.
*/
@@ -3583,24 +3570,6 @@ export class Config implements McpContext, AgentLoopContext {
return undefined;
}
/**
* Returns whether Gemini 3.1 Flash Lite has been launched.
*
* Note: This method should only be called after startup, once experiments have been loaded.
* If you need to call this during startup or from an async context, use
* getGemini31FlashLiteLaunched instead.
*/
getGemini31FlashLiteLaunchedSync(): boolean {
const authType = this.contentGeneratorConfig?.authType;
if (this.isGemini31LaunchedForAuthType(authType)) {
return true;
}
return (
this.experiments?.flags[ExperimentFlags.GEMINI_3_1_FLASH_LITE_LAUNCHED]
?.boolValue ?? false
);
}
/**
* Returns the client version.
*/
+19 -25
View File
@@ -107,6 +107,12 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
model: 'gemini-2.5-flash-lite',
},
},
'gemini-3.1-flash-lite': {
extends: 'chat-base-3',
modelConfig: {
model: 'gemini-3.1-flash-lite',
},
},
'gemma-4-31b-it': {
extends: 'chat-base-3',
modelConfig: {
@@ -136,7 +142,7 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
classifier: {
extends: 'base',
modelConfig: {
model: 'gemini-2.5-flash-lite',
model: 'flash-lite',
generateContentConfig: {
maxOutputTokens: 1024,
thinkingConfig: {
@@ -148,7 +154,7 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
'prompt-completion': {
extends: 'base',
modelConfig: {
model: 'gemini-2.5-flash-lite',
model: 'flash-lite',
generateContentConfig: {
temperature: 0.3,
maxOutputTokens: 16000,
@@ -161,7 +167,7 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
'fast-ack-helper': {
extends: 'base',
modelConfig: {
model: 'gemini-2.5-flash-lite',
model: 'flash-lite',
generateContentConfig: {
temperature: 0.2,
maxOutputTokens: 120,
@@ -174,7 +180,7 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
'edit-corrector': {
extends: 'base',
modelConfig: {
model: 'gemini-2.5-flash-lite',
model: 'flash-lite',
generateContentConfig: {
thinkingConfig: {
thinkingBudget: 0,
@@ -185,7 +191,7 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
'summarizer-default': {
extends: 'base',
modelConfig: {
model: 'gemini-2.5-flash-lite',
model: 'flash-lite',
generateContentConfig: {
maxOutputTokens: 2000,
},
@@ -194,7 +200,7 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
'summarizer-shell': {
extends: 'base',
modelConfig: {
model: 'gemini-2.5-flash-lite',
model: 'flash-lite',
generateContentConfig: {
maxOutputTokens: 2000,
},
@@ -264,7 +270,7 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
},
'chat-compression-3.1-flash-lite': {
modelConfig: {
model: 'gemini-3.1-flash-lite-preview',
model: 'gemini-3.1-flash-lite',
},
},
'chat-compression-2.5-pro': {
@@ -305,10 +311,10 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
],
modelDefinitions: {
// Concrete Models
'gemini-3.1-flash-lite-preview': {
'gemini-3.1-flash-lite': {
tier: 'flash-lite',
family: 'gemini-3',
isPreview: true,
isPreview: false,
isVisible: true,
features: { thinking: false, multimodalToolUse: true },
},
@@ -492,14 +498,8 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
},
],
},
'gemini-3.1-flash-lite-preview': {
default: 'gemini-3.1-flash-lite-preview',
contexts: [
{
condition: { useGemini3_1FlashLite: false },
target: 'gemini-2.5-flash-lite',
},
],
'gemini-3.1-flash-lite': {
default: 'gemini-3.1-flash-lite',
},
flash: {
default: 'gemini-3-flash-preview',
@@ -511,13 +511,7 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
],
},
'flash-lite': {
default: 'gemini-2.5-flash-lite',
contexts: [
{
condition: { useGemini3_1FlashLite: true },
target: 'gemini-3.1-flash-lite-preview',
},
],
default: 'gemini-3.1-flash-lite',
},
'auto-gemini-3': {
default: 'gemini-3-pro-preview',
@@ -714,7 +708,7 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
],
lite: [
{
model: 'gemini-2.5-flash-lite',
model: 'flash-lite',
actions: {
terminal: 'silent',
transient: 'silent',
+103 -83
View File
@@ -28,7 +28,7 @@ import {
DEFAULT_GEMINI_MODEL_AUTO,
isActiveModel,
PREVIEW_GEMINI_3_1_MODEL,
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
PREVIEW_GEMINI_FLASH_LITE_MODEL,
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
isPreviewModel,
isProModel,
@@ -67,22 +67,14 @@ describe('Dynamic Configuration Parity', () => {
const flagCombos = [
{
useGemini3_1: false,
useGemini3_1FlashLite: false,
useCustomToolModel: false,
},
{
useGemini3_1: true,
useGemini3_1FlashLite: false,
useCustomToolModel: false,
},
{
useGemini3_1: true,
useGemini3_1FlashLite: true,
useCustomToolModel: false,
},
{
useGemini3_1: true,
useGemini3_1FlashLite: true,
useCustomToolModel: true,
},
];
@@ -105,7 +97,6 @@ describe('Dynamic Configuration Parity', () => {
const legacy = resolveModel(
model,
flags.useGemini3_1,
flags.useGemini3_1FlashLite,
flags.useCustomToolModel,
hasAccess,
mockLegacyConfig,
@@ -113,7 +104,6 @@ describe('Dynamic Configuration Parity', () => {
const dynamic = resolveModel(
model,
flags.useGemini3_1,
flags.useGemini3_1FlashLite,
flags.useCustomToolModel,
hasAccess,
mockDynamicConfig,
@@ -152,7 +142,6 @@ describe('Dynamic Configuration Parity', () => {
anchor,
tier,
flags.useGemini3_1,
flags.useGemini3_1FlashLite,
flags.useCustomToolModel,
hasAccess,
mockLegacyConfig,
@@ -161,7 +150,6 @@ describe('Dynamic Configuration Parity', () => {
anchor,
tier,
flags.useGemini3_1,
flags.useGemini3_1FlashLite,
flags.useCustomToolModel,
hasAccess,
mockDynamicConfig,
@@ -229,12 +217,29 @@ describe('Dynamic Configuration Parity', () => {
});
describe('isPreviewModel', () => {
it('should return true for preview models', () => {
expect(isPreviewModel(PREVIEW_GEMINI_MODEL)).toBe(true);
expect(isPreviewModel(PREVIEW_GEMINI_3_1_MODEL)).toBe(true);
expect(isPreviewModel(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL)).toBe(true);
expect(isPreviewModel(PREVIEW_GEMINI_FLASH_MODEL)).toBe(true);
const PREVIEW_MODELS = [
PREVIEW_GEMINI_MODEL,
PREVIEW_GEMINI_3_1_MODEL,
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
PREVIEW_GEMINI_FLASH_MODEL,
PREVIEW_GEMINI_FLASH_LITE_MODEL,
];
it('should return true for active preview models', () => {
for (const model of PREVIEW_MODELS) {
if (model !== 'none') {
expect(isPreviewModel(model)).toBe(true);
}
}
expect(isPreviewModel(PREVIEW_GEMINI_MODEL_AUTO)).toBe(true);
expect(isPreviewModel(GEMINI_MODEL_ALIAS_AUTO)).toBe(true);
});
it('should return false if a preview model is retired (set to none)', () => {
const retiredModels = PREVIEW_MODELS.filter((m) => m === 'none');
for (const model of retiredModels) {
expect(isPreviewModel(model)).toBe(false);
}
});
it('should return false for non-preview models', () => {
@@ -358,9 +363,9 @@ describe('getDisplayString', () => {
);
});
it('should return PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL for PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL', () => {
expect(getDisplayString(PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL)).toBe(
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
it('should return PREVIEW_GEMINI_FLASH_LITE_MODEL for PREVIEW_GEMINI_FLASH_LITE_MODEL', () => {
expect(getDisplayString(PREVIEW_GEMINI_FLASH_LITE_MODEL)).toBe(
PREVIEW_GEMINI_FLASH_LITE_MODEL,
);
});
@@ -405,7 +410,7 @@ describe('resolveModel', () => {
});
it('should return Gemini 3.1 Pro Custom Tools when auto-gemini-3 is requested, useGemini3_1 is true, and useCustomToolModel is true', () => {
const model = resolveModel(PREVIEW_GEMINI_MODEL_AUTO, true, false, true);
const model = resolveModel(PREVIEW_GEMINI_MODEL_AUTO, true, true);
expect(model).toBe(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL);
});
@@ -419,9 +424,9 @@ describe('resolveModel', () => {
expect(model).toBe(DEFAULT_GEMINI_FLASH_LITE_MODEL);
});
it('should return the Preview Flash-Lite model when flash-lite is requested and useGemini3_1FlashLite is true', () => {
const model = resolveModel(GEMINI_MODEL_ALIAS_FLASH_LITE, false, true);
expect(model).toBe(PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL);
it('should return the Flash-Lite model when flash-lite is requested', () => {
const model = resolveModel(GEMINI_MODEL_ALIAS_FLASH_LITE, false);
expect(model).toBe(DEFAULT_GEMINI_FLASH_LITE_MODEL);
});
it('should return the requested model as-is for explicit specific models', () => {
@@ -452,45 +457,39 @@ describe('resolveModel', () => {
describe('hasAccessToPreview logic', () => {
it('should return default model when access to preview is false and preview model is requested', () => {
expect(
resolveModel(PREVIEW_GEMINI_MODEL, false, false, false, false),
).toBe(DEFAULT_GEMINI_MODEL);
expect(resolveModel(PREVIEW_GEMINI_MODEL, false, false, false)).toBe(
DEFAULT_GEMINI_MODEL,
);
});
it('should return default flash model when access to preview is false and preview flash model is requested', () => {
expect(
resolveModel(PREVIEW_GEMINI_FLASH_MODEL, false, false, false, false),
resolveModel(PREVIEW_GEMINI_FLASH_MODEL, false, false, false),
).toBe(DEFAULT_GEMINI_FLASH_MODEL);
});
it('should return default flash lite model when access to preview is false and preview flash lite model is requested', () => {
expect(
resolveModel(
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
false,
false,
false,
false,
),
resolveModel(PREVIEW_GEMINI_FLASH_LITE_MODEL, false, false, false),
).toBe(DEFAULT_GEMINI_FLASH_LITE_MODEL);
});
it('should return default model when access to preview is false and auto-gemini-3 is requested', () => {
expect(
resolveModel(PREVIEW_GEMINI_MODEL_AUTO, false, false, false, false),
).toBe(DEFAULT_GEMINI_MODEL);
expect(resolveModel(PREVIEW_GEMINI_MODEL_AUTO, false, false, false)).toBe(
DEFAULT_GEMINI_MODEL,
);
});
it('should return default model when access to preview is false and Gemini 3.1 is requested', () => {
expect(
resolveModel(PREVIEW_GEMINI_MODEL_AUTO, true, false, false, false),
).toBe(DEFAULT_GEMINI_MODEL);
expect(resolveModel(PREVIEW_GEMINI_MODEL_AUTO, true, false, false)).toBe(
DEFAULT_GEMINI_MODEL,
);
});
it('should still return default model when access to preview is false and auto-gemini-2.5 is requested', () => {
expect(
resolveModel(DEFAULT_GEMINI_MODEL_AUTO, false, false, false, false),
).toBe(DEFAULT_GEMINI_MODEL);
expect(resolveModel(DEFAULT_GEMINI_MODEL_AUTO, false, false, false)).toBe(
DEFAULT_GEMINI_MODEL,
);
});
});
});
@@ -582,7 +581,6 @@ describe('resolveClassifierModel', () => {
PREVIEW_GEMINI_MODEL_AUTO,
GEMINI_MODEL_ALIAS_PRO,
true,
false,
true,
),
).toBe(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL);
@@ -599,17 +597,14 @@ describe('isActiveModel', () => {
it('should return true for Gemma 4 models when experimentalGemma is not provided (defaults to true)', () => {
expect(isActiveModel(GEMMA_4_31B_IT_MODEL)).toBe(true);
expect(isActiveModel(GEMMA_4_26B_A4B_IT_MODEL)).toBe(true);
expect(isActiveModel(GEMMA_4_31B_IT_MODEL, false, false, false, true)).toBe(
expect(isActiveModel(GEMMA_4_31B_IT_MODEL, false, false, true)).toBe(true);
expect(isActiveModel(GEMMA_4_26B_A4B_IT_MODEL, false, false, true)).toBe(
true,
);
expect(
isActiveModel(GEMMA_4_26B_A4B_IT_MODEL, false, false, false, true),
).toBe(true);
});
it('should return false for Gemini 3.1 models when Gemini 3.1 is not launched', () => {
expect(isActiveModel(PREVIEW_GEMINI_3_1_MODEL)).toBe(false);
expect(isActiveModel(PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL)).toBe(false);
});
it('should return true for unknown models and aliases', () => {
@@ -625,37 +620,48 @@ describe('isActiveModel', () => {
expect(isActiveModel(DEFAULT_GEMINI_MODEL, true)).toBe(true);
});
it('should return true for PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL only when useGemini3_1FlashLite is true', () => {
expect(
isActiveModel(PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL, false, true),
).toBe(true);
expect(isActiveModel(PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL, true, true)).toBe(
it('should handle PREVIEW_GEMINI_FLASH_LITE_MODEL activity correctly based on retirement status', () => {
if (PREVIEW_GEMINI_FLASH_LITE_MODEL === 'none') {
expect(isActiveModel(PREVIEW_GEMINI_FLASH_LITE_MODEL, false, true)).toBe(
false,
);
expect(isActiveModel(PREVIEW_GEMINI_FLASH_LITE_MODEL, true, true)).toBe(
false,
);
} else {
expect(isActiveModel(PREVIEW_GEMINI_FLASH_LITE_MODEL, false, true)).toBe(
true,
);
expect(isActiveModel(PREVIEW_GEMINI_FLASH_LITE_MODEL, true, true)).toBe(
true,
);
}
expect(isActiveModel(DEFAULT_GEMINI_FLASH_LITE_MODEL, false, false)).toBe(
true,
);
expect(isActiveModel(DEFAULT_GEMINI_FLASH_LITE_MODEL, true, true)).toBe(
true,
);
expect(isActiveModel(DEFAULT_GEMINI_FLASH_LITE_MODEL, true, false)).toBe(
true,
);
expect(
isActiveModel(PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL, true, false),
).toBe(false);
});
it('should correctly filter Gemini 3.1 models based on useCustomToolModel when useGemini3_1 is true', () => {
// When custom tools are preferred, standard 3.1 should be inactive
expect(isActiveModel(PREVIEW_GEMINI_3_1_MODEL, true, false, true)).toBe(
false,
);
expect(isActiveModel(PREVIEW_GEMINI_3_1_MODEL, true, true)).toBe(false);
expect(
isActiveModel(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL, true, false, true),
isActiveModel(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL, true, true),
).toBe(true);
// When custom tools are NOT preferred, custom tools 3.1 should be inactive
expect(isActiveModel(PREVIEW_GEMINI_3_1_MODEL, true, false, false)).toBe(
true,
);
expect(isActiveModel(PREVIEW_GEMINI_3_1_MODEL, true, false)).toBe(true);
expect(
isActiveModel(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL, true, false, false),
isActiveModel(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL, true, false),
).toBe(false);
});
it('should return false for Gemini 3.1 models when useGemini3_1 and useGemini3_1FlashLite are false', () => {
it('should return false for Gemini 3.1 preview models when useGemini3_1 is false', () => {
expect(isActiveModel(PREVIEW_GEMINI_3_1_MODEL, false, false, true)).toBe(
false,
);
@@ -668,9 +674,14 @@ describe('isActiveModel', () => {
expect(
isActiveModel(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL, false, false, false),
).toBe(false);
expect(
isActiveModel(PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL, false, false),
).toBe(false);
if (PREVIEW_GEMINI_FLASH_LITE_MODEL !== 'none') {
expect(isActiveModel(PREVIEW_GEMINI_FLASH_LITE_MODEL, false, false)).toBe(
false,
);
}
expect(isActiveModel(DEFAULT_GEMINI_FLASH_LITE_MODEL, false, false)).toBe(
true,
);
});
});
@@ -695,14 +706,23 @@ describe('Gemini 3.1 Config Resolution', () => {
).toBeDefined();
});
it('PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL should resolve to chat-base-3 config (including thinkingLevel)', () => {
const resolved = modelConfigService.getResolvedConfig({
model: PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
isChatModel: true,
});
expect(
resolved.generateContentConfig?.thinkingConfig?.thinkingLevel,
).toBeDefined();
it('PREVIEW_GEMINI_FLASH_LITE_MODEL should resolve to appropriate config based on retirement status', () => {
if (PREVIEW_GEMINI_FLASH_LITE_MODEL === 'none') {
// If none, it falls back to chat-base which may not have thinkingLevel
const resolved = modelConfigService.getResolvedConfig({
model: PREVIEW_GEMINI_FLASH_LITE_MODEL,
isChatModel: true,
});
expect(resolved.model).toBe(PREVIEW_GEMINI_FLASH_LITE_MODEL);
} else {
const resolved = modelConfigService.getResolvedConfig({
model: PREVIEW_GEMINI_FLASH_LITE_MODEL,
isChatModel: true,
});
expect(
resolved.generateContentConfig?.thinkingConfig?.thinkingLevel,
).toBeDefined();
}
});
});
@@ -715,13 +735,13 @@ describe('getAutoModelDescription', () => {
it('should return Gemini 3.0 description when hasAccessToPreview is true', () => {
const desc = getAutoModelDescription(true, false);
expect(desc).toContain('gemini-3-pro');
expect(desc).toContain('gemini-3-flash');
expect(desc).toContain('gemini-3-pro-preview');
expect(desc).toContain('gemini-3-flash-preview');
});
it('should return Gemini 3.1 description when hasAccessToPreview and useGemini3_1 are true', () => {
const desc = getAutoModelDescription(true, true);
expect(desc).toContain('gemini-3.1-pro');
expect(desc).toContain('gemini-3-flash');
expect(desc).toContain('gemini-3.1-pro-preview');
expect(desc).toContain('gemini-3-flash-preview');
});
});
+27 -29
View File
@@ -6,7 +6,6 @@
export interface ModelResolutionContext {
useGemini3_1?: boolean;
useGemini3_1FlashLite?: boolean;
useCustomTools?: boolean;
hasAccessToPreview?: boolean;
requestedModel?: string;
@@ -56,11 +55,11 @@ export const PREVIEW_GEMINI_3_1_MODEL = 'gemini-3.1-pro-preview';
export const PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL =
'gemini-3.1-pro-preview-customtools';
export const PREVIEW_GEMINI_FLASH_MODEL = 'gemini-3-flash-preview';
export const PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL =
'gemini-3.1-flash-lite-preview';
export const DEFAULT_GEMINI_MODEL = 'gemini-2.5-pro';
export const DEFAULT_GEMINI_FLASH_MODEL = 'gemini-2.5-flash';
export const DEFAULT_GEMINI_FLASH_LITE_MODEL = 'gemini-2.5-flash-lite';
export const DEFAULT_GEMINI_FLASH_LITE_MODEL = 'gemini-3.1-flash-lite';
/** @deprecated Gemini 3.1 Flash Lite is now GA. Use DEFAULT_GEMINI_FLASH_LITE_MODEL. */
export const PREVIEW_GEMINI_FLASH_LITE_MODEL = 'none';
export const GEMMA_4_31B_IT_MODEL = 'gemma-4-31b-it';
export const GEMMA_4_26B_A4B_IT_MODEL = 'gemma-4-26b-a4b-it';
@@ -70,7 +69,7 @@ export const VALID_GEMINI_MODELS = new Set([
PREVIEW_GEMINI_3_1_MODEL,
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
PREVIEW_GEMINI_FLASH_MODEL,
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
PREVIEW_GEMINI_FLASH_LITE_MODEL,
DEFAULT_GEMINI_MODEL,
DEFAULT_GEMINI_FLASH_MODEL,
DEFAULT_GEMINI_FLASH_LITE_MODEL,
@@ -101,10 +100,12 @@ export function getAutoModelDescription(
) {
const proModel = hasAccessToPreview
? useGemini3_1
? 'gemini-3.1-pro'
: 'gemini-3-pro'
: 'gemini-2.5-pro';
const flashModel = hasAccessToPreview ? 'gemini-3-flash' : 'gemini-2.5-flash';
? PREVIEW_GEMINI_3_1_MODEL
: PREVIEW_GEMINI_MODEL
: DEFAULT_GEMINI_MODEL;
const flashModel = hasAccessToPreview
? PREVIEW_GEMINI_FLASH_MODEL
: DEFAULT_GEMINI_FLASH_MODEL;
return `Let Gemini CLI decide the best model for the task: ${proModel}, ${flashModel}`;
}
@@ -120,7 +121,6 @@ export function getAutoModelDescription(
export function resolveModel(
requestedModel: string,
useGemini3_1: boolean = false,
useGemini3_1FlashLite: boolean = false,
useCustomToolModel: boolean = false,
hasAccessToPreview: boolean = true,
config?: ModelCapabilityContext,
@@ -135,7 +135,6 @@ export function resolveModel(
if (config?.getExperimentalDynamicModelConfiguration?.() === true) {
const resolved = config.modelConfigService.resolveModelId(normalizedModel, {
useGemini3_1,
useGemini3_1FlashLite,
useCustomTools: useCustomToolModel,
hasAccessToPreview,
});
@@ -184,9 +183,7 @@ export function resolveModel(
break;
}
case GEMINI_MODEL_ALIAS_FLASH_LITE: {
resolved = useGemini3_1FlashLite
? PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL
: DEFAULT_GEMINI_FLASH_LITE_MODEL;
resolved = DEFAULT_GEMINI_FLASH_LITE_MODEL;
break;
}
default: {
@@ -195,13 +192,15 @@ export function resolveModel(
}
}
if (resolved === 'none') {
return DEFAULT_GEMINI_FLASH_LITE_MODEL;
}
if (!hasAccessToPreview && isPreviewModel(resolved)) {
// Downgrade to stable models if user lacks preview access.
switch (resolved) {
case PREVIEW_GEMINI_FLASH_MODEL:
return DEFAULT_GEMINI_FLASH_MODEL;
case PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL:
return DEFAULT_GEMINI_FLASH_LITE_MODEL;
case PREVIEW_GEMINI_MODEL:
case PREVIEW_GEMINI_3_1_MODEL:
case PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL:
@@ -235,7 +234,6 @@ export function resolveClassifierModel(
requestedModel: string,
modelAlias: string,
useGemini3_1: boolean = false,
useGemini3_1FlashLite: boolean = false,
useCustomToolModel: boolean = false,
hasAccessToPreview: boolean = true,
config?: ModelCapabilityContext,
@@ -246,7 +244,6 @@ export function resolveClassifierModel(
requestedModel,
{
useGemini3_1,
useGemini3_1FlashLite,
useCustomTools: useCustomToolModel,
hasAccessToPreview,
},
@@ -273,16 +270,15 @@ export function resolveClassifierModel(
GEMINI_MODEL_ALIAS_FLASH,
false,
false,
false,
hasAccessToPreview,
);
}
return resolveModel(
requestedModel,
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
config,
);
}
@@ -314,8 +310,8 @@ export function getDisplayString(
return PREVIEW_GEMINI_FLASH_MODEL;
case PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL:
return PREVIEW_GEMINI_3_1_MODEL;
case PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL:
return PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL;
case PREVIEW_GEMINI_FLASH_LITE_MODEL:
return PREVIEW_GEMINI_FLASH_LITE_MODEL;
default:
return model;
}
@@ -332,6 +328,9 @@ export function isPreviewModel(
model: string,
config?: ModelCapabilityContext,
): boolean {
if (model === 'none') {
return false;
}
if (config?.getExperimentalDynamicModelConfiguration?.() === true) {
return (
config.modelConfigService.getModelDefinition(model)?.isPreview === true
@@ -345,7 +344,7 @@ export function isPreviewModel(
model === PREVIEW_GEMINI_FLASH_MODEL ||
model === PREVIEW_GEMINI_MODEL_AUTO ||
model === GEMINI_MODEL_ALIAS_AUTO ||
model === PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL
model === PREVIEW_GEMINI_FLASH_LITE_MODEL
);
}
@@ -379,7 +378,7 @@ export function isGemini3Model(
): boolean {
if (config?.getExperimentalDynamicModelConfiguration?.() === true) {
// Legacy behavior resolves the model first.
const resolved = resolveModel(model, false, false, false, true, config);
const resolved = resolveModel(model, false, false, true, config);
return (
config.modelConfigService.getModelDefinition(resolved)?.family ===
'gemini-3'
@@ -414,7 +413,7 @@ export function isCustomModel(
config?: ModelCapabilityContext,
): boolean {
if (config?.getExperimentalDynamicModelConfiguration?.() === true) {
const resolved = resolveModel(model, false, false, false, true, config);
const resolved = resolveModel(model, false, false, true, config);
return (
config.modelConfigService.getModelDefinition(resolved)?.tier ===
'custom' || !resolved.startsWith('gemini-')
@@ -487,18 +486,17 @@ export function supportsMultimodalFunctionResponse(
export function isActiveModel(
model: string,
useGemini3_1: boolean = false,
useGemini3_1FlashLite: boolean = false,
useCustomToolModel: boolean = false,
experimentalGemma: boolean = true,
): boolean {
if (!VALID_GEMINI_MODELS.has(model)) {
if (!VALID_GEMINI_MODELS.has(model) || model === 'none') {
return false;
}
if (model === GEMMA_4_31B_IT_MODEL || model === GEMMA_4_26B_A4B_IT_MODEL) {
return experimentalGemma;
}
if (model === PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL) {
return useGemini3_1FlashLite;
if (model === PREVIEW_GEMINI_FLASH_LITE_MODEL) {
return false;
}
if (useGemini3_1) {
if (model === PREVIEW_GEMINI_MODEL) {
@@ -30,7 +30,7 @@ import {
PREVIEW_GEMINI_MODEL,
PREVIEW_GEMINI_FLASH_MODEL,
PREVIEW_GEMINI_3_1_MODEL,
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
PREVIEW_GEMINI_FLASH_LITE_MODEL,
} from '../config/models.js';
import { PreCompressTrigger } from '../hooks/types.js';
@@ -106,14 +106,16 @@ export function modelStringToModelConfigAlias(model: string): string {
return 'chat-compression-3-pro';
case PREVIEW_GEMINI_FLASH_MODEL:
return 'chat-compression-3-flash';
case PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL:
case PREVIEW_GEMINI_FLASH_LITE_MODEL:
// fallthrough
case DEFAULT_GEMINI_FLASH_LITE_MODEL:
return 'chat-compression-3.1-flash-lite';
case 'gemini-2.5-flash-lite':
return 'chat-compression-2.5-flash-lite';
case DEFAULT_GEMINI_MODEL:
return 'chat-compression-2.5-pro';
case DEFAULT_GEMINI_FLASH_MODEL:
return 'chat-compression-2.5-flash';
case DEFAULT_GEMINI_FLASH_LITE_MODEL:
return 'chat-compression-2.5-flash-lite';
default:
return 'chat-compression-default';
}
-1
View File
@@ -604,7 +604,6 @@ export class GeminiClient {
return resolveModel(
this.config.getActiveModel(),
this.config.getGemini31LaunchedSync?.() ?? false,
this.config.getGemini31FlashLiteLaunchedSync?.() ?? false,
false,
this.config.getHasAccessToPreviewModel?.() ?? true,
this.config,
@@ -218,9 +218,6 @@ export async function createContentGenerator(
config.authType === AuthType.USE_GEMINI ||
config.authType === AuthType.USE_VERTEX_AI ||
((await gcConfig.getGemini31Launched?.()) ?? false),
config.authType === AuthType.USE_GEMINI ||
config.authType === AuthType.USE_VERTEX_AI ||
((await gcConfig.getGemini31FlashLiteLaunched?.()) ?? false),
false,
gcConfig.getHasAccessToPreviewModel?.() ?? true,
gcConfig,
-5
View File
@@ -719,8 +719,6 @@ export class GeminiChat {
const apiCall = async () => {
const useGemini3_1 =
(await this.context.config.getGemini31Launched?.()) ?? false;
const useGemini3_1FlashLite =
(await this.context.config.getGemini31FlashLiteLaunched?.()) ?? false;
const hasAccessToPreview =
this.context.config.getHasAccessToPreviewModel?.() ?? true;
@@ -728,7 +726,6 @@ export class GeminiChat {
let modelToUse = resolveModel(
lastModelToUse,
useGemini3_1,
useGemini3_1FlashLite,
false,
hasAccessToPreview,
this.context.config,
@@ -740,7 +737,6 @@ export class GeminiChat {
modelToUse = resolveModel(
this.context.config.getActiveModel(),
useGemini3_1,
useGemini3_1FlashLite,
false,
hasAccessToPreview,
this.context.config,
@@ -803,7 +799,6 @@ export class GeminiChat {
modelToUse = resolveModel(
beforeModelResult.modifiedModel,
useGemini3_1,
useGemini3_1FlashLite,
false,
hasAccessToPreview,
this.context.config,
+4 -9
View File
@@ -22,7 +22,6 @@ import {
PREVIEW_GEMINI_FLASH_MODEL,
DEFAULT_GEMINI_MODEL_AUTO,
DEFAULT_GEMINI_MODEL,
DEFAULT_GEMINI_FLASH_LITE_MODEL,
} from '../config/models.js';
import { ApprovalMode } from '../policy/types.js';
import { DiscoveredMCPTool } from '../tools/mcp-tool.js';
@@ -253,9 +252,7 @@ describe('Core System Prompt (prompts.ts)', () => {
});
it('should use legacy system prompt for non-preview model', () => {
vi.mocked(mockConfig.getActiveModel).mockReturnValue(
DEFAULT_GEMINI_FLASH_LITE_MODEL,
);
vi.mocked(mockConfig.getActiveModel).mockReturnValue(DEFAULT_GEMINI_MODEL);
const prompt = getCoreSystemPrompt(mockConfig);
expect(prompt).toContain(
'You are an interactive CLI agent specializing in software engineering tasks.',
@@ -270,9 +267,7 @@ describe('Core System Prompt (prompts.ts)', () => {
});
it('should include the TASK MANAGEMENT PROTOCOL in legacy prompt when task tracker is enabled', () => {
vi.mocked(mockConfig.getActiveModel).mockReturnValue(
DEFAULT_GEMINI_FLASH_LITE_MODEL,
);
vi.mocked(mockConfig.getActiveModel).mockReturnValue(DEFAULT_GEMINI_MODEL);
vi.mocked(mockConfig.isTrackerEnabled).mockReturnValue(true);
const prompt = getCoreSystemPrompt(mockConfig);
expect(prompt).toContain('# TASK MANAGEMENT PROTOCOL');
@@ -667,7 +662,7 @@ describe('Core System Prompt (prompts.ts)', () => {
it('should include Windows-specific shell efficiency commands on win32', () => {
mockPlatform('win32');
vi.mocked(mockConfig.getActiveModel).mockReturnValue(
DEFAULT_GEMINI_FLASH_LITE_MODEL,
DEFAULT_GEMINI_MODEL,
);
const prompt = getCoreSystemPrompt(mockConfig);
expect(prompt).toContain(
@@ -681,7 +676,7 @@ describe('Core System Prompt (prompts.ts)', () => {
it('should include generic shell efficiency commands on non-Windows', () => {
mockPlatform('linux');
vi.mocked(mockConfig.getActiveModel).mockReturnValue(
DEFAULT_GEMINI_FLASH_LITE_MODEL,
DEFAULT_GEMINI_MODEL,
);
const prompt = getCoreSystemPrompt(mockConfig);
expect(prompt).toContain("using commands like 'grep', 'tail', 'head'");
@@ -73,7 +73,6 @@ export class PromptProvider {
const desiredModel = resolveModel(
context.config.getActiveModel(),
context.config.getGemini31LaunchedSync?.() ?? false,
context.config.getGemini31FlashLiteLaunchedSync?.() ?? false,
false,
context.config.getHasAccessToPreviewModel?.() ?? true,
context.config,
@@ -297,7 +296,6 @@ export class PromptProvider {
const desiredModel = resolveModel(
context.config.getActiveModel(),
context.config.getGemini31LaunchedSync?.() ?? false,
context.config.getGemini31FlashLiteLaunchedSync?.() ?? false,
false,
context.config.getHasAccessToPreviewModel?.() ?? true,
context.config,
@@ -43,7 +43,6 @@ describe('ApprovalModeStrategy', () => {
getApprovedPlanPath: vi.fn().mockReturnValue(undefined),
getPlanModeRoutingEnabled: vi.fn().mockResolvedValue(true),
getGemini31Launched: vi.fn().mockResolvedValue(false),
getGemini31FlashLiteLaunched: vi.fn().mockResolvedValue(false),
getHasAccessToPreviewModel: vi.fn().mockReturnValue(true),
getUseCustomToolModel: vi.fn().mockImplementation(async () => {
const launched = await mockConfig.getGemini31Launched();
@@ -48,17 +48,12 @@ export class ApprovalModeStrategy implements RoutingStrategy {
const approvalMode = config.getApprovalMode();
const approvedPlanPath = config.getApprovedPlanPath();
const [
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
] = await Promise.all([
config.getGemini31Launched(),
config.getGemini31FlashLiteLaunched(),
config.getUseCustomToolModel(),
config.getHasAccessToPreviewModel(),
]);
const [useGemini3_1, useCustomToolModel, hasAccessToPreview] =
await Promise.all([
config.getGemini31Launched(),
config.getUseCustomToolModel(),
config.getHasAccessToPreviewModel(),
]);
// 1. Planning Phase: If ApprovalMode === PLAN, explicitly route to the Pro model.
if (approvalMode === ApprovalMode.PLAN) {
@@ -66,7 +61,6 @@ export class ApprovalModeStrategy implements RoutingStrategy {
model,
GEMINI_MODEL_ALIAS_PRO,
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
config,
@@ -85,7 +79,6 @@ export class ApprovalModeStrategy implements RoutingStrategy {
model,
GEMINI_MODEL_ALIAS_FLASH,
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
config,
@@ -60,7 +60,6 @@ describe('ClassifierStrategy', () => {
getModel: vi.fn().mockReturnValue(DEFAULT_GEMINI_MODEL_AUTO),
getNumericalRoutingEnabled: vi.fn().mockResolvedValue(false),
getGemini31Launched: vi.fn().mockResolvedValue(false),
getGemini31FlashLiteLaunched: vi.fn().mockResolvedValue(false),
getUseCustomToolModel: vi.fn().mockImplementation(async () => {
const launched = await mockConfig.getGemini31Launched();
const authType = mockConfig.getContentGeneratorConfig().authType;
@@ -172,18 +172,15 @@ export class ClassifierStrategy implements RoutingStrategy {
const reasoning = routerResponse.reasoning;
const latencyMs = Date.now() - startTime;
const [useGemini3_1, useGemini3_1FlashLite, useCustomToolModel] =
await Promise.all([
config.getGemini31Launched(),
config.getGemini31FlashLiteLaunched(),
config.getUseCustomToolModel(),
]);
const [useGemini3_1, useCustomToolModel] = await Promise.all([
config.getGemini31Launched(),
config.getUseCustomToolModel(),
]);
const selectedModel = normalizeModelId(
resolveClassifierModel(
normalizeModelId(model),
routerResponse.model_choice,
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
config.getHasAccessToPreviewModel?.() ?? true,
config,
@@ -26,7 +26,6 @@ export class DefaultStrategy implements TerminalStrategy {
const defaultModel = resolveModel(
config.getModel(),
config.getGemini31LaunchedSync?.() ?? false,
config.getGemini31FlashLiteLaunchedSync?.() ?? false,
false,
config.getHasAccessToPreviewModel?.() ?? true,
config,
@@ -28,7 +28,6 @@ export class FallbackStrategy implements RoutingStrategy {
const resolvedModel = resolveModel(
requestedModel,
config.getGemini31LaunchedSync?.() ?? false,
config.getGemini31FlashLiteLaunchedSync?.() ?? false,
false,
config.getHasAccessToPreviewModel?.() ?? true,
config,
@@ -39,7 +39,6 @@ describe('GemmaClassifierStrategy', () => {
getModel: () => DEFAULT_GEMINI_MODEL,
getPreviewFeatures: () => false,
getGemini31Launched: vi.fn().mockResolvedValue(false),
getGemini31FlashLiteLaunched: vi.fn().mockResolvedValue(false),
getUseCustomToolModel: vi.fn().mockResolvedValue(false),
getHasAccessToPreviewModel: vi.fn().mockReturnValue(true),
} as unknown as Config;
@@ -210,23 +210,17 @@ ${formattedHistory}
const reasoning = routerResponse.reasoning;
const latencyMs = Date.now() - startTime;
const [
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
] = await Promise.all([
config.getGemini31Launched(),
config.getGemini31FlashLiteLaunched(),
config.getUseCustomToolModel(),
config.getHasAccessToPreviewModel?.() ?? true,
]);
const [useGemini3_1, useCustomToolModel, hasAccessToPreview] =
await Promise.all([
config.getGemini31Launched(),
config.getUseCustomToolModel(),
config.getHasAccessToPreviewModel(),
]);
const selectedModel = resolveClassifierModel(
context.requestedModel ?? config.getModel(),
routerResponse.model_choice,
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
config,
@@ -63,7 +63,6 @@ describe('NumericalClassifierStrategy', () => {
getResolvedClassifierThreshold: vi.fn().mockResolvedValue(90),
getClassifierThreshold: vi.fn().mockResolvedValue(undefined),
getGemini31Launched: vi.fn().mockResolvedValue(false),
getGemini31FlashLiteLaunched: vi.fn().mockResolvedValue(false),
getUseCustomToolModel: vi.fn().mockImplementation(async () => {
const launched = await mockConfig.getGemini31Launched();
const authType = mockConfig.getContentGeneratorConfig().authType;
@@ -167,18 +167,15 @@ export class NumericalClassifierStrategy implements RoutingStrategy {
const { threshold, groupLabel, modelAlias } =
await this.getRoutingDecision(score, config);
const [useGemini3_1, useGemini3_1FlashLite, useCustomToolModel] =
await Promise.all([
config.getGemini31Launched(),
config.getGemini31FlashLiteLaunched(),
config.getUseCustomToolModel(),
]);
const [useGemini3_1, useCustomToolModel] = await Promise.all([
config.getGemini31Launched(),
config.getUseCustomToolModel(),
]);
const selectedModel = normalizeModelId(
resolveClassifierModel(
normalizeModelId(model),
modelAlias,
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
config.getHasAccessToPreviewModel?.() ?? true,
config,
@@ -38,7 +38,6 @@ export class OverrideStrategy implements RoutingStrategy {
model: resolveModel(
overrideModel,
config.getGemini31LaunchedSync?.() ?? false,
config.getGemini31FlashLiteLaunchedSync?.() ?? false,
false,
config.getHasAccessToPreviewModel?.() ?? true,
config,
@@ -9,7 +9,6 @@ import type { ModelPolicy } from '../availability/modelPolicy.js';
import {
getDisplayString,
PREVIEW_GEMINI_3_1_MODEL,
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
isProModel,
getAutoModelDescription,
} from '../config/models.js';
@@ -156,7 +155,6 @@ export class ModelConfigService {
const definitions = this.config.modelDefinitions ?? {};
const shouldShowPreviewModels = context.hasAccessToPreview ?? false;
const useGemini31 = context.useGemini3_1 ?? false;
const useGemini31FlashLite = context.useGemini3_1FlashLite ?? false;
const mainOptions = Object.entries(definitions)
.filter(([_, m]) => {
@@ -192,15 +190,12 @@ export class ModelConfigService {
if (context.hasAccessToProModel === false && isProModel(id))
return false;
if (id === PREVIEW_GEMINI_3_1_MODEL && !useGemini31) return false;
if (id === PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL && !useGemini31FlashLite)
return false;
return true;
})
.map(([id, m]) => {
const resolvedId = this.resolveModelId(id, context);
const titleId = this.resolveModelId(id, {
useGemini3_1: useGemini31,
useGemini3_1FlashLite: useGemini31FlashLite,
});
return {
modelId: resolvedId,
@@ -133,6 +133,18 @@
"topK": 64
}
},
"gemini-3.1-flash-lite": {
"model": "gemini-3.1-flash-lite",
"generateContentConfig": {
"temperature": 1,
"topP": 0.95,
"thinkingConfig": {
"includeThoughts": true,
"thinkingLevel": "HIGH"
},
"topK": 64
}
},
"gemma-4-31b-it": {
"model": "gemma-4-31b-it",
"generateContentConfig": {
@@ -172,7 +184,7 @@
}
},
"classifier": {
"model": "gemini-2.5-flash-lite",
"model": "flash-lite",
"generateContentConfig": {
"temperature": 0,
"topP": 1,
@@ -183,7 +195,7 @@
}
},
"prompt-completion": {
"model": "gemini-2.5-flash-lite",
"model": "flash-lite",
"generateContentConfig": {
"temperature": 0.3,
"topP": 1,
@@ -194,7 +206,7 @@
}
},
"fast-ack-helper": {
"model": "gemini-2.5-flash-lite",
"model": "flash-lite",
"generateContentConfig": {
"temperature": 0.2,
"topP": 1,
@@ -205,7 +217,7 @@
}
},
"edit-corrector": {
"model": "gemini-2.5-flash-lite",
"model": "flash-lite",
"generateContentConfig": {
"temperature": 0,
"topP": 1,
@@ -215,7 +227,7 @@
}
},
"summarizer-default": {
"model": "gemini-2.5-flash-lite",
"model": "flash-lite",
"generateContentConfig": {
"temperature": 0,
"topP": 1,
@@ -223,7 +235,7 @@
}
},
"summarizer-shell": {
"model": "gemini-2.5-flash-lite",
"model": "flash-lite",
"generateContentConfig": {
"temperature": 0,
"topP": 1,
@@ -309,7 +321,7 @@
"generateContentConfig": {}
},
"chat-compression-3.1-flash-lite": {
"model": "gemini-3.1-flash-lite-preview",
"model": "gemini-3.1-flash-lite",
"generateContentConfig": {}
},
"chat-compression-2.5-pro": {
@@ -133,6 +133,18 @@
"topK": 64
}
},
"gemini-3.1-flash-lite": {
"model": "gemini-3.1-flash-lite",
"generateContentConfig": {
"temperature": 1,
"topP": 0.95,
"thinkingConfig": {
"includeThoughts": true,
"thinkingLevel": "HIGH"
},
"topK": 64
}
},
"gemma-4-31b-it": {
"model": "gemma-4-31b-it",
"generateContentConfig": {
@@ -172,7 +184,7 @@
}
},
"classifier": {
"model": "gemini-2.5-flash-lite",
"model": "flash-lite",
"generateContentConfig": {
"temperature": 0,
"topP": 1,
@@ -183,7 +195,7 @@
}
},
"prompt-completion": {
"model": "gemini-2.5-flash-lite",
"model": "flash-lite",
"generateContentConfig": {
"temperature": 0.3,
"topP": 1,
@@ -194,7 +206,7 @@
}
},
"fast-ack-helper": {
"model": "gemini-2.5-flash-lite",
"model": "flash-lite",
"generateContentConfig": {
"temperature": 0.2,
"topP": 1,
@@ -205,7 +217,7 @@
}
},
"edit-corrector": {
"model": "gemini-2.5-flash-lite",
"model": "flash-lite",
"generateContentConfig": {
"temperature": 0,
"topP": 1,
@@ -215,7 +227,7 @@
}
},
"summarizer-default": {
"model": "gemini-2.5-flash-lite",
"model": "flash-lite",
"generateContentConfig": {
"temperature": 0,
"topP": 1,
@@ -223,7 +235,7 @@
}
},
"summarizer-shell": {
"model": "gemini-2.5-flash-lite",
"model": "flash-lite",
"generateContentConfig": {
"temperature": 0,
"topP": 1,
@@ -309,7 +321,7 @@
"generateContentConfig": {}
},
"chat-compression-3.1-flash-lite": {
"model": "gemini-3.1-flash-lite-preview",
"model": "gemini-3.1-flash-lite",
"generateContentConfig": {}
},
"chat-compression-2.5-pro": {