@@ -10,9 +10,11 @@ import type { RoutingContext } from '../routingStrategy.js';
1010import type { Config } from '../../config/config.js' ;
1111import type { BaseLlmClient } from '../../core/baseLlmClient.js' ;
1212import {
13- DEFAULT_GEMINI_FLASH_MODEL ,
14- DEFAULT_GEMINI_MODEL ,
13+ PREVIEW_GEMINI_FLASH_MODEL ,
14+ PREVIEW_GEMINI_MODEL ,
1515 DEFAULT_GEMINI_MODEL_AUTO ,
16+ DEFAULT_GEMINI_MODEL ,
17+ PREVIEW_GEMINI_MODEL_AUTO ,
1618} from '../../config/models.js' ;
1719import { promptIdContext } from '../../utils/promptIdContext.js' ;
1820import type { Content } from '@google/genai' ;
@@ -46,8 +48,8 @@ describe('NumericalClassifierStrategy', () => {
4648 modelConfigService : {
4749 getResolvedConfig : vi . fn ( ) . mockReturnValue ( mockResolvedConfig ) ,
4850 } ,
49- getModel : ( ) => DEFAULT_GEMINI_MODEL_AUTO ,
50- getPreviewFeatures : ( ) => false ,
51+ getModel : vi . fn ( ) . mockReturnValue ( PREVIEW_GEMINI_MODEL_AUTO ) ,
52+ getPreviewFeatures : vi . fn ( ) . mockReturnValue ( false ) ,
5153 getSessionId : vi . fn ( ) . mockReturnValue ( 'control-group-id' ) , // Default to Control Group (Hash 71 >= 50)
5254 getNumericalRoutingEnabled : vi . fn ( ) . mockResolvedValue ( true ) ,
5355 getClassifierThreshold : vi . fn ( ) . mockResolvedValue ( undefined ) ,
@@ -76,6 +78,32 @@ describe('NumericalClassifierStrategy', () => {
7678 expect ( mockBaseLlmClient . generateJson ) . not . toHaveBeenCalled ( ) ;
7779 } ) ;
7880
81+ it ( 'should return null if the model is not a Gemini 3 model' , async ( ) => {
82+ vi . mocked ( mockConfig . getModel ) . mockReturnValue ( DEFAULT_GEMINI_MODEL_AUTO ) ;
83+
84+ const decision = await strategy . route (
85+ mockContext ,
86+ mockConfig ,
87+ mockBaseLlmClient ,
88+ ) ;
89+
90+ expect ( decision ) . toBeNull ( ) ;
91+ expect ( mockBaseLlmClient . generateJson ) . not . toHaveBeenCalled ( ) ;
92+ } ) ;
93+
94+ it ( 'should return null if the model is explicitly a Gemini 2 model' , async ( ) => {
95+ vi . mocked ( mockConfig . getModel ) . mockReturnValue ( DEFAULT_GEMINI_MODEL ) ;
96+
97+ const decision = await strategy . route (
98+ mockContext ,
99+ mockConfig ,
100+ mockBaseLlmClient ,
101+ ) ;
102+
103+ expect ( decision ) . toBeNull ( ) ;
104+ expect ( mockBaseLlmClient . generateJson ) . not . toHaveBeenCalled ( ) ;
105+ } ) ;
106+
79107 it ( 'should call generateJson with the correct parameters and wrapped user content' , async ( ) => {
80108 const mockApiResponse = {
81109 complexity_reasoning : 'Simple task' ,
@@ -120,7 +148,7 @@ describe('NumericalClassifierStrategy', () => {
120148 ) ;
121149
122150 expect ( decision ) . toEqual ( {
123- model : DEFAULT_GEMINI_FLASH_MODEL ,
151+ model : PREVIEW_GEMINI_FLASH_MODEL ,
124152 metadata : {
125153 source : 'NumericalClassifier (Control)' ,
126154 latencyMs : expect . any ( Number ) ,
@@ -146,7 +174,7 @@ describe('NumericalClassifierStrategy', () => {
146174 ) ;
147175
148176 expect ( decision ) . toEqual ( {
149- model : DEFAULT_GEMINI_MODEL ,
177+ model : PREVIEW_GEMINI_MODEL ,
150178 metadata : {
151179 source : 'NumericalClassifier (Control)' ,
152180 latencyMs : expect . any ( Number ) ,
@@ -172,7 +200,7 @@ describe('NumericalClassifierStrategy', () => {
172200 ) ;
173201
174202 expect ( decision ) . toEqual ( {
175- model : DEFAULT_GEMINI_FLASH_MODEL , // Routed to Flash because 60 < 80
203+ model : PREVIEW_GEMINI_FLASH_MODEL , // Routed to Flash because 60 < 80
176204 metadata : {
177205 source : 'NumericalClassifier (Strict)' ,
178206 latencyMs : expect . any ( Number ) ,
@@ -198,7 +226,7 @@ describe('NumericalClassifierStrategy', () => {
198226 ) ;
199227
200228 expect ( decision ) . toEqual ( {
201- model : DEFAULT_GEMINI_MODEL ,
229+ model : PREVIEW_GEMINI_MODEL ,
202230 metadata : {
203231 source : 'NumericalClassifier (Strict)' ,
204232 latencyMs : expect . any ( Number ) ,
@@ -226,7 +254,7 @@ describe('NumericalClassifierStrategy', () => {
226254 ) ;
227255
228256 expect ( decision ) . toEqual ( {
229- model : DEFAULT_GEMINI_FLASH_MODEL , // Score 60 < Threshold 70
257+ model : PREVIEW_GEMINI_FLASH_MODEL , // Score 60 < Threshold 70
230258 metadata : {
231259 source : 'NumericalClassifier (Remote)' ,
232260 latencyMs : expect . any ( Number ) ,
@@ -252,7 +280,7 @@ describe('NumericalClassifierStrategy', () => {
252280 ) ;
253281
254282 expect ( decision ) . toEqual ( {
255- model : DEFAULT_GEMINI_FLASH_MODEL , // Score 40 < Threshold 45.5
283+ model : PREVIEW_GEMINI_FLASH_MODEL , // Score 40 < Threshold 45.5
256284 metadata : {
257285 source : 'NumericalClassifier (Remote)' ,
258286 latencyMs : expect . any ( Number ) ,
@@ -278,7 +306,7 @@ describe('NumericalClassifierStrategy', () => {
278306 ) ;
279307
280308 expect ( decision ) . toEqual ( {
281- model : DEFAULT_GEMINI_MODEL , // Score 35 >= Threshold 30
309+ model : PREVIEW_GEMINI_MODEL , // Score 35 >= Threshold 30
282310 metadata : {
283311 source : 'NumericalClassifier (Remote)' ,
284312 latencyMs : expect . any ( Number ) ,
@@ -306,7 +334,7 @@ describe('NumericalClassifierStrategy', () => {
306334 ) ;
307335
308336 expect ( decision ) . toEqual ( {
309- model : DEFAULT_GEMINI_FLASH_MODEL , // Score 40 < Default A/B Threshold 50
337+ model : PREVIEW_GEMINI_FLASH_MODEL , // Score 40 < Default A/B Threshold 50
310338 metadata : {
311339 source : 'NumericalClassifier (Control)' ,
312340 latencyMs : expect . any ( Number ) ,
@@ -333,7 +361,7 @@ describe('NumericalClassifierStrategy', () => {
333361 ) ;
334362
335363 expect ( decision ) . toEqual ( {
336- model : DEFAULT_GEMINI_FLASH_MODEL ,
364+ model : PREVIEW_GEMINI_FLASH_MODEL ,
337365 metadata : {
338366 source : 'NumericalClassifier (Control)' ,
339367 latencyMs : expect . any ( Number ) ,
@@ -360,7 +388,7 @@ describe('NumericalClassifierStrategy', () => {
360388 ) ;
361389
362390 expect ( decision ) . toEqual ( {
363- model : DEFAULT_GEMINI_MODEL ,
391+ model : PREVIEW_GEMINI_MODEL ,
364392 metadata : {
365393 source : 'NumericalClassifier (Control)' ,
366394 latencyMs : expect . any ( Number ) ,
0 commit comments