diff --git a/.changeset/stale-pianos-add.md b/.changeset/stale-pianos-add.md new file mode 100644 index 0000000000000000000000000000000000000000..5eb26fa3513823b739066fc22426b1a6f56d0c7d --- /dev/null +++ b/.changeset/stale-pianos-add.md @@ -0,0 +1,5 @@ +--- +"llamaindex": patch +--- + +feat: added gemini 002 support diff --git a/packages/llamaindex/src/llm/gemini/base.ts b/packages/llamaindex/src/llm/gemini/base.ts index ace5ba20537b85ba3826fd700ae138cd3fdf8a96..0046e11c4d1f230703ee1615bd506585946dedcf 100644 --- a/packages/llamaindex/src/llm/gemini/base.ts +++ b/packages/llamaindex/src/llm/gemini/base.ts @@ -44,12 +44,15 @@ import { export const GEMINI_MODEL_INFO_MAP: Record<GEMINI_MODEL, GeminiModelInfo> = { [GEMINI_MODEL.GEMINI_PRO]: { contextWindow: 30720 }, [GEMINI_MODEL.GEMINI_PRO_VISION]: { contextWindow: 12288 }, - [GEMINI_MODEL.GEMINI_PRO_LATEST]: { contextWindow: 10 ** 6 }, // multi-modal/multi turn + [GEMINI_MODEL.GEMINI_PRO_LATEST]: { contextWindow: 10 ** 6 }, + [GEMINI_MODEL.GEMINI_PRO_FLASH_LATEST]: { contextWindow: 10 ** 6 }, [GEMINI_MODEL.GEMINI_PRO_1_5_PRO_PREVIEW]: { contextWindow: 10 ** 6 }, [GEMINI_MODEL.GEMINI_PRO_1_5_FLASH_PREVIEW]: { contextWindow: 10 ** 6 }, [GEMINI_MODEL.GEMINI_PRO_1_5]: { contextWindow: 2 * 10 ** 6 }, [GEMINI_MODEL.GEMINI_PRO_1_5_FLASH]: { contextWindow: 10 ** 6 }, + [GEMINI_MODEL.GEMINI_PRO_1_5_LATEST]: { contextWindow: 2 * 10 ** 6 }, + [GEMINI_MODEL.GEMINI_PRO_1_5_FLASH_LATEST]: { contextWindow: 10 ** 6 }, }; const SUPPORT_TOOL_CALL_MODELS: GEMINI_MODEL[] = [ @@ -59,6 +62,10 @@ const SUPPORT_TOOL_CALL_MODELS: GEMINI_MODEL[] = [ GEMINI_MODEL.GEMINI_PRO_1_5_FLASH_PREVIEW, GEMINI_MODEL.GEMINI_PRO_1_5, GEMINI_MODEL.GEMINI_PRO_1_5_FLASH, + GEMINI_MODEL.GEMINI_PRO_LATEST, + GEMINI_MODEL.GEMINI_PRO_FLASH_LATEST, + GEMINI_MODEL.GEMINI_PRO_1_5_LATEST, + GEMINI_MODEL.GEMINI_PRO_1_5_FLASH_LATEST, ]; const DEFAULT_GEMINI_PARAMS = { diff --git a/packages/llamaindex/src/llm/gemini/types.ts b/packages/llamaindex/src/llm/gemini/types.ts index 58bc65648b314a0681d73477fada7bcbaa1f3ad3..c74d563531fdd353cd651d0031d1ee3786ae0462 100644 --- a/packages/llamaindex/src/llm/gemini/types.ts +++ b/packages/llamaindex/src/llm/gemini/types.ts @@ -56,10 +56,14 @@ export enum GEMINI_MODEL { GEMINI_PRO = "gemini-pro", GEMINI_PRO_VISION = "gemini-pro-vision", GEMINI_PRO_LATEST = "gemini-1.5-pro-latest", + GEMINI_PRO_FLASH_LATEST = "gemini-1.5-flash-latest", GEMINI_PRO_1_5_PRO_PREVIEW = "gemini-1.5-pro-preview-0514", GEMINI_PRO_1_5_FLASH_PREVIEW = "gemini-1.5-flash-preview-0514", GEMINI_PRO_1_5 = "gemini-1.5-pro-001", GEMINI_PRO_1_5_FLASH = "gemini-1.5-flash-001", + // Note: should be switched to -latest suffix when google supports it + GEMINI_PRO_1_5_LATEST = "gemini-1.5-pro-002", + GEMINI_PRO_1_5_FLASH_LATEST = "gemini-1.5-flash-002", } export interface GeminiModelInfo {