mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-14 23:31:13 -07:00
feat: launch Gemini 3 Flash in Gemini CLI ⚡️⚡️⚡️ (#15196)
Co-authored-by: gemini-cli-robot <gemini-cli-robot@google.com> Co-authored-by: joshualitt <joshualitt@google.com> Co-authored-by: Sehoon Shon <sshon@google.com> Co-authored-by: Adam Weidman <65992621+adamfweidman@users.noreply.github.com> Co-authored-by: Adib234 <30782825+Adib234@users.noreply.github.com> Co-authored-by: Jenna Inouye <jinouye@google.com>
This commit is contained in:
committed by
GitHub
parent
18698d6929
commit
bf90b59935
@@ -12,7 +12,7 @@ import {
|
||||
LS_TOOL_NAME,
|
||||
READ_FILE_TOOL_NAME,
|
||||
} from '../tools/tool-names.js';
|
||||
import { GEMINI_MODEL_ALIAS_PRO } from '../config/models.js';
|
||||
import { DEFAULT_GEMINI_MODEL } from '../config/models.js';
|
||||
|
||||
describe('CodebaseInvestigatorAgent', () => {
|
||||
it('should have the correct agent definition', () => {
|
||||
@@ -26,7 +26,7 @@ describe('CodebaseInvestigatorAgent', () => {
|
||||
).toBe(true);
|
||||
expect(CodebaseInvestigatorAgent.outputConfig?.outputName).toBe('report');
|
||||
expect(CodebaseInvestigatorAgent.modelConfig?.model).toBe(
|
||||
GEMINI_MODEL_ALIAS_PRO,
|
||||
DEFAULT_GEMINI_MODEL,
|
||||
);
|
||||
expect(CodebaseInvestigatorAgent.toolConfig?.tools).toEqual([
|
||||
LS_TOOL_NAME,
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
LS_TOOL_NAME,
|
||||
READ_FILE_TOOL_NAME,
|
||||
} from '../tools/tool-names.js';
|
||||
import { GEMINI_MODEL_ALIAS_PRO } from '../config/models.js';
|
||||
import { DEFAULT_GEMINI_MODEL } from '../config/models.js';
|
||||
import { z } from 'zod';
|
||||
|
||||
// Define a type that matches the outputConfig schema for type safety.
|
||||
@@ -70,7 +70,7 @@ export const CodebaseInvestigatorAgent: LocalAgentDefinition<
|
||||
processOutput: (output) => JSON.stringify(output, null, 2),
|
||||
|
||||
modelConfig: {
|
||||
model: GEMINI_MODEL_ALIAS_PRO,
|
||||
model: DEFAULT_GEMINI_MODEL,
|
||||
temp: 0.1,
|
||||
top_p: 0.95,
|
||||
thinkingBudget: -1,
|
||||
|
||||
@@ -10,6 +10,13 @@ import { makeFakeConfig } from '../test-utils/config.js';
|
||||
import type { AgentDefinition, LocalAgentDefinition } from './types.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import { debugLogger } from '../utils/debugLogger.js';
|
||||
import {
|
||||
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
||||
GEMINI_MODEL_ALIAS_AUTO,
|
||||
PREVIEW_GEMINI_FLASH_MODEL,
|
||||
PREVIEW_GEMINI_MODEL,
|
||||
PREVIEW_GEMINI_MODEL_AUTO,
|
||||
} from '../config/models.js';
|
||||
|
||||
// A test-only subclass to expose the protected `registerAgent` method.
|
||||
class TestableAgentRegistry extends AgentRegistry {
|
||||
@@ -74,12 +81,12 @@ describe('AgentRegistry', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should use preview model for codebase investigator if main model is preview', async () => {
|
||||
it('should use preview flash model for codebase investigator if main model is preview pro', async () => {
|
||||
const previewConfig = makeFakeConfig({
|
||||
model: 'gemini-3-pro-preview',
|
||||
model: PREVIEW_GEMINI_MODEL,
|
||||
codebaseInvestigatorSettings: {
|
||||
enabled: true,
|
||||
model: 'pro',
|
||||
model: GEMINI_MODEL_ALIAS_AUTO,
|
||||
},
|
||||
});
|
||||
const previewRegistry = new TestableAgentRegistry(previewConfig);
|
||||
@@ -88,10 +95,52 @@ describe('AgentRegistry', () => {
|
||||
|
||||
const investigatorDef = previewRegistry.getDefinition(
|
||||
'codebase_investigator',
|
||||
);
|
||||
) as LocalAgentDefinition;
|
||||
expect(investigatorDef).toBeDefined();
|
||||
expect((investigatorDef as LocalAgentDefinition).modelConfig.model).toBe(
|
||||
'gemini-3-pro-preview',
|
||||
expect(investigatorDef?.modelConfig.model).toBe(
|
||||
PREVIEW_GEMINI_FLASH_MODEL,
|
||||
);
|
||||
});
|
||||
|
||||
it('should use preview flash model for codebase investigator if main model is preview auto', async () => {
|
||||
const previewConfig = makeFakeConfig({
|
||||
model: PREVIEW_GEMINI_MODEL_AUTO,
|
||||
codebaseInvestigatorSettings: {
|
||||
enabled: true,
|
||||
model: GEMINI_MODEL_ALIAS_AUTO,
|
||||
},
|
||||
});
|
||||
const previewRegistry = new TestableAgentRegistry(previewConfig);
|
||||
|
||||
await previewRegistry.initialize();
|
||||
|
||||
const investigatorDef = previewRegistry.getDefinition(
|
||||
'codebase_investigator',
|
||||
) as LocalAgentDefinition;
|
||||
expect(investigatorDef).toBeDefined();
|
||||
expect(investigatorDef?.modelConfig.model).toBe(
|
||||
PREVIEW_GEMINI_FLASH_MODEL,
|
||||
);
|
||||
});
|
||||
|
||||
it('should use the model from the investigator settings', async () => {
|
||||
const previewConfig = makeFakeConfig({
|
||||
model: PREVIEW_GEMINI_MODEL,
|
||||
codebaseInvestigatorSettings: {
|
||||
enabled: true,
|
||||
model: DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
||||
},
|
||||
});
|
||||
const previewRegistry = new TestableAgentRegistry(previewConfig);
|
||||
|
||||
await previewRegistry.initialize();
|
||||
|
||||
const investigatorDef = previewRegistry.getDefinition(
|
||||
'codebase_investigator',
|
||||
) as LocalAgentDefinition;
|
||||
expect(investigatorDef).toBeDefined();
|
||||
expect(investigatorDef?.modelConfig.model).toBe(
|
||||
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,11 +10,13 @@ import { CodebaseInvestigatorAgent } from './codebase-investigator.js';
|
||||
import { type z } from 'zod';
|
||||
import { debugLogger } from '../utils/debugLogger.js';
|
||||
import {
|
||||
DEFAULT_GEMINI_MODEL_AUTO,
|
||||
GEMINI_MODEL_ALIAS_PRO,
|
||||
PREVIEW_GEMINI_MODEL,
|
||||
DEFAULT_GEMINI_MODEL,
|
||||
GEMINI_MODEL_ALIAS_AUTO,
|
||||
PREVIEW_GEMINI_FLASH_MODEL,
|
||||
isPreviewModel,
|
||||
} from '../config/models.js';
|
||||
import type { ModelConfigAlias } from '../services/modelConfigService.js';
|
||||
import { coreEvents, CoreEvent } from '../utils/events.js';
|
||||
|
||||
/**
|
||||
* Returns the model config alias for a given agent definition.
|
||||
@@ -41,6 +43,10 @@ export class AgentRegistry {
|
||||
async initialize(): Promise<void> {
|
||||
this.loadBuiltInAgents();
|
||||
|
||||
coreEvents.on(CoreEvent.ModelChanged, () => {
|
||||
this.loadBuiltInAgents();
|
||||
});
|
||||
|
||||
if (this.config.getDebugMode()) {
|
||||
debugLogger.log(
|
||||
`[AgentRegistry] Initialized with ${this.agents.size} agents.`,
|
||||
@@ -53,19 +59,17 @@ export class AgentRegistry {
|
||||
|
||||
// Only register the agent if it's enabled in the settings.
|
||||
if (investigatorSettings?.enabled) {
|
||||
let model =
|
||||
investigatorSettings.model ??
|
||||
CodebaseInvestigatorAgent.modelConfig.model;
|
||||
|
||||
// If the user is using the preview model for the main agent, force the sub-agent to use it too
|
||||
// if it's configured to use 'pro' or 'auto'.
|
||||
if (this.config.getModel() === PREVIEW_GEMINI_MODEL) {
|
||||
if (
|
||||
model === GEMINI_MODEL_ALIAS_PRO ||
|
||||
model === DEFAULT_GEMINI_MODEL_AUTO
|
||||
) {
|
||||
model = PREVIEW_GEMINI_MODEL;
|
||||
}
|
||||
let model;
|
||||
const settingsModel = investigatorSettings.model;
|
||||
// Check if the user explicitly set a model in the settings.
|
||||
if (settingsModel && settingsModel !== GEMINI_MODEL_ALIAS_AUTO) {
|
||||
model = settingsModel;
|
||||
} else {
|
||||
// Use Preview Flash model if the main model is any of the preview models
|
||||
// If the main model is not preview model, use default pro model.
|
||||
model = isPreviewModel(this.config.getModel())
|
||||
? PREVIEW_GEMINI_FLASH_MODEL
|
||||
: DEFAULT_GEMINI_MODEL;
|
||||
}
|
||||
|
||||
const agentDef = {
|
||||
|
||||
Reference in New Issue
Block a user