Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ describe('ApprovalModeStrategy', () => {
getApprovedPlanPath: vi.fn().mockReturnValue(undefined),
getPlanModeRoutingEnabled: vi.fn().mockResolvedValue(true),
getGemini31Launched: vi.fn().mockResolvedValue(false),
getGemini31FlashLiteLaunched: vi.fn().mockResolvedValue(false),
getHasAccessToPreviewModel: vi.fn().mockReturnValue(true),
getUseCustomToolModel: vi.fn().mockImplementation(async () => {
const launched = await mockConfig.getGemini31Launched();
const authType = mockConfig.getContentGeneratorConfig?.()?.authType;
Expand Down
15 changes: 14 additions & 1 deletion packages/core/src/routing/strategies/approvalModeStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,16 @@ export class ApprovalModeStrategy implements RoutingStrategy {
const approvalMode = config.getApprovalMode();
const approvedPlanPath = config.getApprovedPlanPath();

const [useGemini3_1, useCustomToolModel] = await Promise.all([
const [
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
] = await Promise.all([
config.getGemini31Launched(),
config.getGemini31FlashLiteLaunched(),
config.getUseCustomToolModel(),
config.getHasAccessToPreviewModel(),
]);
Comment thread
danielweis marked this conversation as resolved.

// 1. Planning Phase: If ApprovalMode === PLAN, explicitly route to the Pro model.
Expand All @@ -59,7 +66,10 @@ export class ApprovalModeStrategy implements RoutingStrategy {
model,
GEMINI_MODEL_ALIAS_PRO,
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
config,
);
return {
model: proModel,
Expand All @@ -75,7 +85,10 @@ export class ApprovalModeStrategy implements RoutingStrategy {
model,
GEMINI_MODEL_ALIAS_FLASH,
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
config,
);
return {
model: flashModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ describe('GemmaClassifierStrategy', () => {
}),
getModel: () => DEFAULT_GEMINI_MODEL,
getPreviewFeatures: () => false,
getGemini31Launched: vi.fn().mockResolvedValue(false),
getGemini31FlashLiteLaunched: vi.fn().mockResolvedValue(false),
getUseCustomToolModel: vi.fn().mockResolvedValue(false),
getHasAccessToPreviewModel: vi.fn().mockReturnValue(true),
} as unknown as Config;

strategy = new GemmaClassifierStrategy();
Expand Down
18 changes: 18 additions & 0 deletions packages/core/src/routing/strategies/gemmaClassifierStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,27 @@ ${formattedHistory}

const reasoning = routerResponse.reasoning;
const latencyMs = Date.now() - startTime;

const [
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
] = await Promise.all([
config.getGemini31Launched(),
config.getGemini31FlashLiteLaunched(),
config.getUseCustomToolModel(),
config.getHasAccessToPreviewModel?.() ?? true,
]);

const selectedModel = resolveClassifierModel(
context.requestedModel ?? config.getModel(),
routerResponse.model_choice,
useGemini3_1,
useGemini3_1FlashLite,
useCustomToolModel,
hasAccessToPreview,
config,
);

return {
Expand Down
Loading