mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-24 03:54:43 -07:00
Co-authored-by: matt korwel <matt.korwel@gmail.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import { describe, it, expect } from 'vitest';
|
||||
import {
|
||||
resolveModel,
|
||||
resolveClassifierModel,
|
||||
isGemini3Model,
|
||||
isGemini2Model,
|
||||
isAutoModel,
|
||||
getDisplayString,
|
||||
@@ -25,6 +26,29 @@ import {
|
||||
DEFAULT_GEMINI_MODEL_AUTO,
|
||||
} from './models.js';
|
||||
|
||||
describe('isGemini3Model', () => {
|
||||
it('should return true for gemini-3 models', () => {
|
||||
expect(isGemini3Model('gemini-3-pro-preview')).toBe(true);
|
||||
expect(isGemini3Model('gemini-3-flash-preview')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return true for aliases that resolve to Gemini 3 when preview is enabled', () => {
|
||||
expect(isGemini3Model(GEMINI_MODEL_ALIAS_AUTO, true)).toBe(true);
|
||||
expect(isGemini3Model(GEMINI_MODEL_ALIAS_PRO, true)).toBe(true);
|
||||
expect(isGemini3Model(PREVIEW_GEMINI_MODEL_AUTO)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for Gemini 2 models', () => {
|
||||
expect(isGemini3Model('gemini-2.5-pro')).toBe(false);
|
||||
expect(isGemini3Model('gemini-2.5-flash')).toBe(false);
|
||||
expect(isGemini3Model(DEFAULT_GEMINI_MODEL_AUTO)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for arbitrary strings', () => {
|
||||
expect(isGemini3Model('gpt-4')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getDisplayString', () => {
|
||||
it('should return Auto (Gemini 3) for preview auto model', () => {
|
||||
expect(getDisplayString(PREVIEW_GEMINI_MODEL_AUTO)).toBe('Auto (Gemini 3)');
|
||||
|
||||
@@ -137,6 +137,20 @@ export function isPreviewModel(model: string): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the model is a Gemini 3 model.
|
||||
*
|
||||
* @param model The model name to check.
|
||||
* @returns True if the model is a Gemini 3 model.
|
||||
*/
|
||||
export function isGemini3Model(
|
||||
model: string,
|
||||
previewFeaturesEnabled = false,
|
||||
): boolean {
|
||||
const resolved = resolveModel(model, previewFeaturesEnabled);
|
||||
return /^gemini-3(\.|-|$)/.test(resolved);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the model is a Gemini 2.x model.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user