Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions packages/core/src/config/models.explicit-flash.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import { describe, expect, it } from 'vitest';
import {
DEFAULT_GEMINI_FLASH_MODEL,
GEMINI_MODEL_ALIAS_FLASH,
PREVIEW_GEMINI_FLASH_MODEL,
resolveModel,
} from './models.js';

describe('explicit flash model resolution', () => {
it.each([
'gemini-3.6-flash',
'gemini-3.7-flash',
'gemini-3.9-flash',
'gemini-4.2-flash',
])('preserves explicit model id %s during the Gemini 3.5 Flash rollout', (model) => {
expect(resolveModel(model, false, false, true, undefined, true)).toBe(model);
});

it('still promotes the flash alias during the Gemini 3.5 Flash rollout', () => {
expect(
resolveModel(
GEMINI_MODEL_ALIAS_FLASH,
false,
false,
true,
undefined,
true,
),
).toBe(DEFAULT_GEMINI_FLASH_MODEL);
});

it('still preserves an explicitly selected preview flash model', () => {
expect(
resolveModel(
PREVIEW_GEMINI_FLASH_MODEL,
false,
false,
true,
undefined,
true,
),
).toBe(PREVIEW_GEMINI_FLASH_MODEL);
});
});
18 changes: 5 additions & 13 deletions packages/core/src/config/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,11 @@ export function resolveModel(

if (
useGemini3_5Flash &&
isFlashModel(resolved) &&
normalizedModel !== PREVIEW_GEMINI_FLASH_MODEL
normalizedModel !== PREVIEW_GEMINI_FLASH_MODEL &&
(resolved === DEFAULT_GEMINI_FLASH_MODEL ||
resolved === DEFAULT_GEMINI_3_5_FLASH_MODEL ||
resolved === SECONDARY_GEMINI_3_5_FLASH_MODEL ||
normalizedModel === GEMINI_MODEL_ALIAS_FLASH)
) {
return DEFAULT_GEMINI_FLASH_MODEL;
}
Expand Down Expand Up @@ -259,17 +262,6 @@ export function resolveModel(
return resolved;
}

function isFlashModel(model: string): boolean {
return (
model === DEFAULT_GEMINI_FLASH_MODEL ||
model === PREVIEW_GEMINI_FLASH_MODEL ||
model === DEFAULT_GEMINI_3_5_FLASH_MODEL ||
model === SECONDARY_GEMINI_3_5_FLASH_MODEL ||
model === 'flash' ||
model.endsWith('flash')
);
}

/**
* Resolves the appropriate model based on the classifier's decision.
*
Expand Down