mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-14 22:02:59 -07:00
feat(core): add support for gemma-4-31b-it model and gemma4-31b alias
This commit is contained in:
@@ -100,6 +100,17 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
|
||||
},
|
||||
},
|
||||
},
|
||||
'gemma4-31b': {
|
||||
extends: 'base',
|
||||
modelConfig: {
|
||||
model: 'gemma-4-31b-it',
|
||||
generateContentConfig: {
|
||||
temperature: 1,
|
||||
topP: 0.95,
|
||||
topK: 64,
|
||||
},
|
||||
},
|
||||
},
|
||||
// Bases for the internal model configs.
|
||||
'gemini-2.5-flash-base': {
|
||||
extends: 'base',
|
||||
@@ -318,6 +329,13 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
|
||||
isVisible: true,
|
||||
features: { thinking: false, multimodalToolUse: false },
|
||||
},
|
||||
'gemma-4-31b-it': {
|
||||
tier: 'pro',
|
||||
family: 'gemma-4',
|
||||
isPreview: false,
|
||||
isVisible: true,
|
||||
features: { thinking: false, multimodalToolUse: false },
|
||||
},
|
||||
// Aliases
|
||||
auto: {
|
||||
tier: 'auto',
|
||||
@@ -331,6 +349,12 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
|
||||
isVisible: true,
|
||||
features: { thinking: false, multimodalToolUse: false },
|
||||
},
|
||||
'gemma4-31b': {
|
||||
tier: 'pro',
|
||||
isPreview: false,
|
||||
isVisible: true,
|
||||
features: { thinking: false, multimodalToolUse: false },
|
||||
},
|
||||
pro: {
|
||||
tier: 'pro',
|
||||
isPreview: false,
|
||||
@@ -443,6 +467,9 @@ export const DEFAULT_MODEL_CONFIGS: ModelConfigServiceConfig = {
|
||||
gemma4: {
|
||||
default: 'gemma-4-26b-a4b-it',
|
||||
},
|
||||
'gemma4-31b': {
|
||||
default: 'gemma-4-31b-it',
|
||||
},
|
||||
},
|
||||
classifierIdResolutions: {
|
||||
flash: {
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
getDisplayString,
|
||||
DEFAULT_GEMINI_MODEL,
|
||||
DEFAULT_GEMMA_4_MODEL,
|
||||
DEFAULT_GEMMA_4_31B_MODEL,
|
||||
PREVIEW_GEMINI_MODEL,
|
||||
DEFAULT_GEMINI_FLASH_MODEL,
|
||||
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
||||
@@ -23,6 +24,7 @@ import {
|
||||
GEMINI_MODEL_ALIAS_PRO,
|
||||
GEMINI_MODEL_ALIAS_FLASH,
|
||||
GEMMA_MODEL_ALIAS_4,
|
||||
GEMMA_MODEL_ALIAS_4_31B,
|
||||
GEMINI_MODEL_ALIAS_AUTO,
|
||||
PREVIEW_GEMINI_FLASH_MODEL,
|
||||
PREVIEW_GEMINI_MODEL_AUTO,
|
||||
@@ -342,6 +344,10 @@ describe('getDisplayString', () => {
|
||||
expect(getDisplayString(DEFAULT_GEMMA_4_MODEL)).toBe('Gemma 4 (26B)');
|
||||
});
|
||||
|
||||
it('should return the correct display string for Gemma 4 31B', () => {
|
||||
expect(getDisplayString(DEFAULT_GEMMA_4_31B_MODEL)).toBe('Gemma 4 (31B)');
|
||||
});
|
||||
|
||||
it('should return the model name as is for other models', () => {
|
||||
expect(getDisplayString('custom-model')).toBe('custom-model');
|
||||
expect(getDisplayString(DEFAULT_GEMINI_FLASH_LITE_MODEL)).toBe(
|
||||
@@ -403,6 +409,11 @@ describe('resolveModel', () => {
|
||||
expect(model).toBe(DEFAULT_GEMMA_4_MODEL);
|
||||
});
|
||||
|
||||
it('should return Gemma 4 31B when gemma4-31b alias is requested', () => {
|
||||
const model = resolveModel(GEMMA_MODEL_ALIAS_4_31B);
|
||||
expect(model).toBe(DEFAULT_GEMMA_4_31B_MODEL);
|
||||
});
|
||||
|
||||
it('should return a custom model name when requested', () => {
|
||||
const customModel = 'custom-model-v1';
|
||||
const model = resolveModel(customModel);
|
||||
@@ -549,6 +560,7 @@ describe('isActiveModel', () => {
|
||||
expect(isActiveModel(DEFAULT_GEMINI_FLASH_MODEL)).toBe(true);
|
||||
expect(isActiveModel(PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL)).toBe(true);
|
||||
expect(isActiveModel(DEFAULT_GEMMA_4_MODEL)).toBe(true);
|
||||
expect(isActiveModel(DEFAULT_GEMMA_4_31B_MODEL)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for unknown models and aliases', () => {
|
||||
|
||||
@@ -60,6 +60,7 @@ 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_GEMMA_4_MODEL = 'gemma-4-26b-a4b-it';
|
||||
export const DEFAULT_GEMMA_4_31B_MODEL = 'gemma-4-31b-it';
|
||||
|
||||
export const VALID_GEMINI_MODELS = new Set([
|
||||
PREVIEW_GEMINI_MODEL,
|
||||
@@ -71,6 +72,7 @@ export const VALID_GEMINI_MODELS = new Set([
|
||||
DEFAULT_GEMINI_FLASH_MODEL,
|
||||
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
||||
DEFAULT_GEMMA_4_MODEL,
|
||||
DEFAULT_GEMMA_4_31B_MODEL,
|
||||
]);
|
||||
|
||||
export const PREVIEW_GEMINI_MODEL_AUTO = 'auto-gemini-3';
|
||||
@@ -82,6 +84,7 @@ export const GEMINI_MODEL_ALIAS_PRO = 'pro';
|
||||
export const GEMINI_MODEL_ALIAS_FLASH = 'flash';
|
||||
export const GEMINI_MODEL_ALIAS_FLASH_LITE = 'flash-lite';
|
||||
export const GEMMA_MODEL_ALIAS_4 = 'gemma4';
|
||||
export const GEMMA_MODEL_ALIAS_4_31B = 'gemma4-31b';
|
||||
|
||||
export const DEFAULT_GEMINI_EMBEDDING_MODEL = 'gemini-embedding-001';
|
||||
|
||||
@@ -143,6 +146,10 @@ export function resolveModel(
|
||||
resolved = DEFAULT_GEMMA_4_MODEL;
|
||||
break;
|
||||
}
|
||||
case GEMMA_MODEL_ALIAS_4_31B: {
|
||||
resolved = DEFAULT_GEMMA_4_31B_MODEL;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
resolved = requestedModel;
|
||||
break;
|
||||
@@ -245,6 +252,8 @@ export function getDisplayString(
|
||||
return PREVIEW_GEMINI_3_1_MODEL;
|
||||
case DEFAULT_GEMMA_4_MODEL:
|
||||
return 'Gemma 4 (26B)';
|
||||
case DEFAULT_GEMMA_4_31B_MODEL:
|
||||
return 'Gemma 4 (31B)';
|
||||
default:
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -105,6 +105,14 @@
|
||||
"topK": 64
|
||||
}
|
||||
},
|
||||
"gemma4-31b": {
|
||||
"model": "gemma-4-31b-it",
|
||||
"generateContentConfig": {
|
||||
"temperature": 1,
|
||||
"topP": 0.95,
|
||||
"topK": 64
|
||||
}
|
||||
},
|
||||
"gemini-2.5-flash-base": {
|
||||
"model": "gemini-2.5-flash",
|
||||
"generateContentConfig": {
|
||||
|
||||
@@ -105,6 +105,14 @@
|
||||
"topK": 64
|
||||
}
|
||||
},
|
||||
"gemma4-31b": {
|
||||
"model": "gemma-4-31b-it",
|
||||
"generateContentConfig": {
|
||||
"temperature": 1,
|
||||
"topP": 0.95,
|
||||
"topK": 64
|
||||
}
|
||||
},
|
||||
"gemini-2.5-flash-base": {
|
||||
"model": "gemini-2.5-flash",
|
||||
"generateContentConfig": {
|
||||
|
||||
Reference in New Issue
Block a user