Remove previewFeatures and default to Gemini 3 (#18414)

This commit is contained in:
Sehoon Shon
2026-02-06 13:02:57 -05:00
committed by GitHub
parent 1495294cc0
commit 61d92c4a21
57 changed files with 91 additions and 797 deletions
@@ -51,7 +51,6 @@ describe('ClassifierStrategy', () => {
getResolvedConfig: vi.fn().mockReturnValue(mockResolvedConfig),
},
getModel: () => DEFAULT_GEMINI_MODEL_AUTO,
getPreviewFeatures: () => false,
getNumericalRoutingEnabled: vi.fn().mockResolvedValue(false),
} as unknown as Config;
mockBaseLlmClient = {
@@ -166,7 +166,6 @@ export class ClassifierStrategy implements RoutingStrategy {
const selectedModel = resolveClassifierModel(
context.requestedModel ?? config.getModel(),
routerResponse.model_choice,
config.getPreviewFeatures(),
);
return {
@@ -24,7 +24,6 @@ describe('DefaultStrategy', () => {
const mockContext = {} as RoutingContext;
const mockConfig = {
getModel: vi.fn().mockReturnValue(DEFAULT_GEMINI_MODEL_AUTO),
getPreviewFeatures: vi.fn().mockReturnValue(false),
} as unknown as Config;
const mockClient = {} as BaseLlmClient;
@@ -45,7 +44,6 @@ describe('DefaultStrategy', () => {
const mockContext = {} as RoutingContext;
const mockConfig = {
getModel: vi.fn().mockReturnValue(PREVIEW_GEMINI_MODEL_AUTO),
getPreviewFeatures: vi.fn().mockReturnValue(false),
} as unknown as Config;
const mockClient = {} as BaseLlmClient;
@@ -61,12 +59,11 @@ describe('DefaultStrategy', () => {
});
});
it('should route to the preview model when requested model is auto and previewfeature is on', async () => {
it('should route to the default model when requested model is auto', async () => {
const strategy = new DefaultStrategy();
const mockContext = {} as RoutingContext;
const mockConfig = {
getModel: vi.fn().mockReturnValue(GEMINI_MODEL_ALIAS_AUTO),
getPreviewFeatures: vi.fn().mockReturnValue(true),
} as unknown as Config;
const mockClient = {} as BaseLlmClient;
@@ -82,34 +79,12 @@ describe('DefaultStrategy', () => {
});
});
it('should route to the default model when requested model is auto and previewfeature is off', async () => {
const strategy = new DefaultStrategy();
const mockContext = {} as RoutingContext;
const mockConfig = {
getModel: vi.fn().mockReturnValue(GEMINI_MODEL_ALIAS_AUTO),
getPreviewFeatures: vi.fn().mockReturnValue(false),
} as unknown as Config;
const mockClient = {} as BaseLlmClient;
const decision = await strategy.route(mockContext, mockConfig, mockClient);
expect(decision).toEqual({
model: DEFAULT_GEMINI_MODEL,
metadata: {
source: 'default',
latencyMs: 0,
reasoning: `Routing to default model: ${DEFAULT_GEMINI_MODEL}`,
},
});
});
// this should not happen, adding the test just in case it happens.
it('should route to the same model if it is not an auto mode', async () => {
const strategy = new DefaultStrategy();
const mockContext = {} as RoutingContext;
const mockConfig = {
getModel: vi.fn().mockReturnValue(PREVIEW_GEMINI_FLASH_MODEL),
getPreviewFeatures: vi.fn().mockReturnValue(false),
} as unknown as Config;
const mockClient = {} as BaseLlmClient;
@@ -21,10 +21,7 @@ export class DefaultStrategy implements TerminalStrategy {
config: Config,
_baseLlmClient: BaseLlmClient,
): Promise<RoutingDecision> {
const defaultModel = resolveModel(
config.getModel(),
config.getPreviewFeatures(),
);
const defaultModel = resolveModel(config.getModel());
return {
model: defaultModel,
metadata: {
@@ -25,7 +25,6 @@ const createMockConfig = (overrides: Partial<Config> = {}): Config =>
({
getModelAvailabilityService: vi.fn(),
getModel: vi.fn().mockReturnValue(DEFAULT_GEMINI_MODEL),
getPreviewFeatures: vi.fn().mockReturnValue(false),
...overrides,
}) as unknown as Config;
@@ -23,10 +23,7 @@ export class FallbackStrategy implements RoutingStrategy {
_baseLlmClient: BaseLlmClient,
): Promise<RoutingDecision | null> {
const requestedModel = context.requestedModel ?? config.getModel();
const resolvedModel = resolveModel(
requestedModel,
config.getPreviewFeatures(),
);
const resolvedModel = resolveModel(requestedModel);
const service = config.getModelAvailabilityService();
const snapshot = service.snapshot(resolvedModel);
@@ -47,7 +47,6 @@ describe('NumericalClassifierStrategy', () => {
getResolvedConfig: vi.fn().mockReturnValue(mockResolvedConfig),
},
getModel: () => DEFAULT_GEMINI_MODEL_AUTO,
getPreviewFeatures: () => false,
getSessionId: vi.fn().mockReturnValue('control-group-id'), // Default to Control Group (Hash 71 >= 50)
getNumericalRoutingEnabled: vi.fn().mockResolvedValue(true),
getClassifierThreshold: vi.fn().mockResolvedValue(undefined),
@@ -179,7 +179,6 @@ export class NumericalClassifierStrategy implements RoutingStrategy {
const selectedModel = resolveClassifierModel(
config.getModel(),
modelAlias,
config.getPreviewFeatures(),
);
const latencyMs = Date.now() - startTime;
@@ -19,7 +19,6 @@ describe('OverrideStrategy', () => {
it('should return null when the override model is auto', async () => {
const mockConfig = {
getModel: () => DEFAULT_GEMINI_MODEL_AUTO,
getPreviewFeatures: () => false,
} as Config;
const decision = await strategy.route(mockContext, mockConfig, mockClient);
@@ -30,7 +29,6 @@ describe('OverrideStrategy', () => {
const overrideModel = 'gemini-2.5-pro-custom';
const mockConfig = {
getModel: () => overrideModel,
getPreviewFeatures: () => false,
} as Config;
const decision = await strategy.route(mockContext, mockConfig, mockClient);
@@ -48,7 +46,6 @@ describe('OverrideStrategy', () => {
const overrideModel = 'gemini-2.5-flash-experimental';
const mockConfig = {
getModel: () => overrideModel,
getPreviewFeatures: () => false,
} as Config;
const decision = await strategy.route(mockContext, mockConfig, mockClient);
@@ -62,7 +59,6 @@ describe('OverrideStrategy', () => {
const configModel = 'config-model';
const mockConfig = {
getModel: () => configModel,
getPreviewFeatures: () => false,
} as Config;
const contextWithRequestedModel = {
requestedModel,
@@ -33,7 +33,7 @@ export class OverrideStrategy implements RoutingStrategy {
// Return the overridden model name.
return {
model: resolveModel(overrideModel, config.getPreviewFeatures()),
model: resolveModel(overrideModel),
metadata: {
source: this.name,
latencyMs: 0,