mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-30 23:14:32 -07:00
# feat(routing): Introduce useModelRouter feature flag (#8366)
This commit is contained in:
@@ -523,6 +523,31 @@ describe('Server Config (config.ts)', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('UseModelRouter Configuration', () => {
|
||||
it('should default useModelRouter to false when not provided', () => {
|
||||
const config = new Config(baseParams);
|
||||
expect(config.getUseModelRouter()).toBe(false);
|
||||
});
|
||||
|
||||
it('should set useModelRouter to true when provided as true', () => {
|
||||
const paramsWithModelRouter: ConfigParameters = {
|
||||
...baseParams,
|
||||
useModelRouter: true,
|
||||
};
|
||||
const config = new Config(paramsWithModelRouter);
|
||||
expect(config.getUseModelRouter()).toBe(true);
|
||||
});
|
||||
|
||||
it('should set useModelRouter to false when explicitly provided as false', () => {
|
||||
const paramsWithModelRouter: ConfigParameters = {
|
||||
...baseParams,
|
||||
useModelRouter: false,
|
||||
};
|
||||
const config = new Config(paramsWithModelRouter);
|
||||
expect(config.getUseModelRouter()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('createToolRegistry', () => {
|
||||
it('should register a tool if coreTools contains an argument-specific pattern', async () => {
|
||||
const params: ConfigParameters = {
|
||||
|
||||
@@ -44,7 +44,6 @@ import { StartSessionEvent } from '../telemetry/index.js';
|
||||
import {
|
||||
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
||||
DEFAULT_GEMINI_FLASH_MODEL,
|
||||
DEFAULT_GEMINI_MODEL,
|
||||
} from './models.js';
|
||||
import { shouldAttemptBrowserLaunch } from '../utils/browser.js';
|
||||
import type { MCPOAuthConfig } from '../mcp/oauth-provider.js';
|
||||
@@ -240,6 +239,7 @@ export interface ConfigParameters {
|
||||
useSmartEdit?: boolean;
|
||||
policyEngineConfig?: PolicyEngineConfig;
|
||||
output?: OutputSettings;
|
||||
useModelRouter?: boolean;
|
||||
}
|
||||
|
||||
export class Config {
|
||||
@@ -327,6 +327,7 @@ export class Config {
|
||||
private readonly messageBus: MessageBus;
|
||||
private readonly policyEngine: PolicyEngine;
|
||||
private readonly outputSettings: OutputSettings;
|
||||
private readonly useModelRouter: boolean;
|
||||
|
||||
constructor(params: ConfigParameters) {
|
||||
this.sessionId = params.sessionId;
|
||||
@@ -376,7 +377,7 @@ export class Config {
|
||||
this.cwd = params.cwd ?? process.cwd();
|
||||
this.fileDiscoveryService = params.fileDiscoveryService ?? null;
|
||||
this.bugCommand = params.bugCommand;
|
||||
this.model = params.model || DEFAULT_GEMINI_MODEL;
|
||||
this.model = params.model;
|
||||
this.extensionContextFilePaths = params.extensionContextFilePaths ?? [];
|
||||
this.maxSessionTurns = params.maxSessionTurns ?? -1;
|
||||
this.experimentalZedIntegration =
|
||||
@@ -411,6 +412,7 @@ export class Config {
|
||||
this.enableToolOutputTruncation =
|
||||
params.enableToolOutputTruncation ?? false;
|
||||
this.useSmartEdit = params.useSmartEdit ?? true;
|
||||
this.useModelRouter = params.useModelRouter ?? false;
|
||||
this.extensionManagement = params.extensionManagement ?? true;
|
||||
this.storage = new Storage(this.targetDir);
|
||||
this.enablePromptCompletion = params.enablePromptCompletion ?? false;
|
||||
@@ -931,6 +933,10 @@ export class Config {
|
||||
: OutputFormat.TEXT;
|
||||
}
|
||||
|
||||
getUseModelRouter(): boolean {
|
||||
return this.useModelRouter;
|
||||
}
|
||||
|
||||
async getGitService(): Promise<GitService> {
|
||||
if (!this.gitService) {
|
||||
this.gitService = new GitService(this.targetDir, this.storage);
|
||||
|
||||
@@ -8,6 +8,8 @@ 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_MODEL_AUTO = 'auto';
|
||||
|
||||
export const DEFAULT_GEMINI_EMBEDDING_MODEL = 'gemini-embedding-001';
|
||||
|
||||
// Some thinking models do not default to dynamic thinking which is done by a value of -1
|
||||
|
||||
Reference in New Issue
Block a user