mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 21:03:05 -07:00
chore: clean up unused models and use consts (#16246)
This commit is contained in:
@@ -6,14 +6,24 @@
|
|||||||
|
|
||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import { tokenLimit, DEFAULT_TOKEN_LIMIT } from './tokenLimits.js';
|
import { tokenLimit, DEFAULT_TOKEN_LIMIT } from './tokenLimits.js';
|
||||||
|
import {
|
||||||
|
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
||||||
|
DEFAULT_GEMINI_FLASH_MODEL,
|
||||||
|
DEFAULT_GEMINI_MODEL,
|
||||||
|
PREVIEW_GEMINI_FLASH_MODEL,
|
||||||
|
PREVIEW_GEMINI_MODEL,
|
||||||
|
} from '../config/models.js';
|
||||||
|
|
||||||
describe('tokenLimit', () => {
|
describe('tokenLimit', () => {
|
||||||
it('should return the correct token limit for gemini-1.5-pro', () => {
|
it('should return the correct token limit for default models', () => {
|
||||||
expect(tokenLimit('gemini-1.5-pro')).toBe(2_097_152);
|
expect(tokenLimit(DEFAULT_GEMINI_MODEL)).toBe(1_048_576);
|
||||||
|
expect(tokenLimit(DEFAULT_GEMINI_FLASH_MODEL)).toBe(1_048_576);
|
||||||
|
expect(tokenLimit(DEFAULT_GEMINI_FLASH_LITE_MODEL)).toBe(1_048_576);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the correct token limit for gemini-1.5-flash', () => {
|
it('should return the correct token limit for preview models', () => {
|
||||||
expect(tokenLimit('gemini-1.5-flash')).toBe(1_048_576);
|
expect(tokenLimit(PREVIEW_GEMINI_MODEL)).toBe(1_048_576);
|
||||||
|
expect(tokenLimit(PREVIEW_GEMINI_FLASH_MODEL)).toBe(1_048_576);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the default token limit for an unknown model', () => {
|
it('should return the default token limit for an unknown model', () => {
|
||||||
|
|||||||
@@ -4,6 +4,14 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
||||||
|
DEFAULT_GEMINI_FLASH_MODEL,
|
||||||
|
DEFAULT_GEMINI_MODEL,
|
||||||
|
PREVIEW_GEMINI_FLASH_MODEL,
|
||||||
|
PREVIEW_GEMINI_MODEL,
|
||||||
|
} from '../config/models.js';
|
||||||
|
|
||||||
type Model = string;
|
type Model = string;
|
||||||
type TokenCount = number;
|
type TokenCount = number;
|
||||||
|
|
||||||
@@ -13,19 +21,12 @@ export function tokenLimit(model: Model): TokenCount {
|
|||||||
// Add other models as they become relevant or if specified by config
|
// Add other models as they become relevant or if specified by config
|
||||||
// Pulled from https://ai.google.dev/gemini-api/docs/models
|
// Pulled from https://ai.google.dev/gemini-api/docs/models
|
||||||
switch (model) {
|
switch (model) {
|
||||||
case 'gemini-1.5-pro':
|
case PREVIEW_GEMINI_MODEL:
|
||||||
return 2_097_152;
|
case PREVIEW_GEMINI_FLASH_MODEL:
|
||||||
case 'gemini-1.5-flash':
|
case DEFAULT_GEMINI_MODEL:
|
||||||
case 'gemini-2.5-pro-preview-05-06':
|
case DEFAULT_GEMINI_FLASH_MODEL:
|
||||||
case 'gemini-2.5-pro-preview-06-05':
|
case DEFAULT_GEMINI_FLASH_LITE_MODEL:
|
||||||
case 'gemini-2.5-pro':
|
|
||||||
case 'gemini-2.5-flash-preview-05-20':
|
|
||||||
case 'gemini-2.5-flash':
|
|
||||||
case 'gemini-2.5-flash-lite':
|
|
||||||
case 'gemini-2.0-flash':
|
|
||||||
return 1_048_576;
|
return 1_048_576;
|
||||||
case 'gemini-2.0-flash-preview-image-generation':
|
|
||||||
return 32_000;
|
|
||||||
default:
|
default:
|
||||||
return DEFAULT_TOKEN_LIMIT;
|
return DEFAULT_TOKEN_LIMIT;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user