mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-14 20:10:36 -07:00
Transition to flash GA model when experiment flag is present. (#27570)
This commit is contained in:
@@ -1044,6 +1044,79 @@ describe('ModelConfigService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// Resolves a model ID to a concrete model ID based on the provided context.
|
||||
describe('resolveModelId', () => {
|
||||
it('should resolve based on useGemini3_5Flash condition', () => {
|
||||
const config: ModelConfigServiceConfig = {
|
||||
modelIdResolutions: {
|
||||
flash: {
|
||||
default: 'gemini-2.0-flash',
|
||||
contexts: [
|
||||
{
|
||||
condition: { useGemini3_5Flash: true },
|
||||
target: 'gemini-3.5-flash',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
const service = new ModelConfigService(config);
|
||||
|
||||
expect(service.resolveModelId('flash', { useGemini3_5Flash: true })).toBe(
|
||||
'gemini-3.5-flash',
|
||||
);
|
||||
expect(
|
||||
service.resolveModelId('flash', { useGemini3_5Flash: false }),
|
||||
).toBe('gemini-2.0-flash');
|
||||
expect(service.resolveModelId('flash', {})).toBe('gemini-2.0-flash');
|
||||
});
|
||||
|
||||
it('should resolve based on complex conditions including useGemini3_5Flash', () => {
|
||||
const config: ModelConfigServiceConfig = {
|
||||
modelIdResolutions: {
|
||||
'gemini-flash': {
|
||||
default: 'gemini-3-flash-preview',
|
||||
contexts: [
|
||||
{
|
||||
condition: {
|
||||
useGemini3_5Flash: false,
|
||||
hasAccessToPreview: false,
|
||||
},
|
||||
target: 'gemini-2.5-flash',
|
||||
},
|
||||
{
|
||||
condition: { useGemini3_5Flash: true },
|
||||
target: 'gemini-3.5-flash',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
const service = new ModelConfigService(config);
|
||||
|
||||
// Case 1: GA Access granted
|
||||
expect(
|
||||
service.resolveModelId('gemini-flash', { useGemini3_5Flash: true }),
|
||||
).toBe('gemini-3.5-flash');
|
||||
|
||||
// Case 2: GA Access denied, but has preview access
|
||||
expect(
|
||||
service.resolveModelId('gemini-flash', {
|
||||
useGemini3_5Flash: false,
|
||||
hasAccessToPreview: true,
|
||||
}),
|
||||
).toBe('gemini-3-flash-preview');
|
||||
|
||||
// Case 3: GA Access denied AND no preview access
|
||||
expect(
|
||||
service.resolveModelId('gemini-flash', {
|
||||
useGemini3_5Flash: false,
|
||||
hasAccessToPreview: false,
|
||||
}),
|
||||
).toBe('gemini-2.5-flash');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getAvailableModelOptions', () => {
|
||||
it('should filter out Pro models when hasAccessToProModel is false', () => {
|
||||
const config: ModelConfigServiceConfig = {
|
||||
|
||||
Reference in New Issue
Block a user