From c612239ecb90d6809503ea5d867d14617a93d9b3 Mon Sep 17 00:00:00 2001 From: Timothy Carambat Date: Wed, 11 Sep 2024 13:03:14 -0700 Subject: [PATCH] Add Gemini `exp` models (#2268) Add Gemini models resolves #2263 --- .../LLMSelection/GeminiLLMOptions/index.jsx | 41 +++++++++++++------ frontend/src/hooks/useGetProvidersModels.js | 3 ++ server/utils/AiProviders/gemini/index.js | 6 +++ server/utils/AiProviders/modelMap.js | 3 ++ server/utils/helpers/updateENV.js | 3 ++ 5 files changed, 43 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/LLMSelection/GeminiLLMOptions/index.jsx b/frontend/src/components/LLMSelection/GeminiLLMOptions/index.jsx index e7a873b9d..5e7a4d785 100644 --- a/frontend/src/components/LLMSelection/GeminiLLMOptions/index.jsx +++ b/frontend/src/components/LLMSelection/GeminiLLMOptions/index.jsx @@ -30,19 +30,34 @@ export default function GeminiLLMOptions({ settings }) { required={true} className="bg-zinc-900 border-gray-500 text-white text-sm rounded-lg block w-full p-2.5" > - {[ - "gemini-pro", - "gemini-1.0-pro", - "gemini-1.5-pro-latest", - "gemini-1.5-flash-latest", - "gemini-1.5-pro-exp-0801", - ].map((model) => { - return ( - - ); - })} + + {[ + "gemini-pro", + "gemini-1.0-pro", + "gemini-1.5-pro-latest", + "gemini-1.5-flash-latest", + ].map((model) => { + return ( + + ); + })} + + + {[ + "gemini-1.5-pro-exp-0801", + "gemini-1.5-pro-exp-0827", + "gemini-1.5-flash-exp-0827", + "gemini-1.5-flash-8b-exp-0827", + ].map((model) => { + return ( + + ); + })} +
diff --git a/frontend/src/hooks/useGetProvidersModels.js b/frontend/src/hooks/useGetProvidersModels.js index fc0311a59..ca9c42ca5 100644 --- a/frontend/src/hooks/useGetProvidersModels.js +++ b/frontend/src/hooks/useGetProvidersModels.js @@ -17,6 +17,9 @@ const PROVIDER_DEFAULT_MODELS = { "gemini-1.5-pro-latest", "gemini-1.5-flash-latest", "gemini-1.5-pro-exp-0801", + "gemini-1.5-pro-exp-0827", + "gemini-1.5-flash-exp-0827", + "gemini-1.5-flash-8b-exp-0827", ], anthropic: [ "claude-instant-1.2", diff --git a/server/utils/AiProviders/gemini/index.js b/server/utils/AiProviders/gemini/index.js index 7acc924cc..a35adab84 100644 --- a/server/utils/AiProviders/gemini/index.js +++ b/server/utils/AiProviders/gemini/index.js @@ -23,6 +23,9 @@ class GeminiLLM { "gemini-1.5-pro-latest", "gemini-1.5-flash-latest", "gemini-1.5-pro-exp-0801", + "gemini-1.5-pro-exp-0827", + "gemini-1.5-flash-exp-0827", + "gemini-1.5-flash-8b-exp-0827", ].includes(this.model) ? "v1beta" : "v1", @@ -105,6 +108,9 @@ class GeminiLLM { "gemini-1.5-pro-latest", "gemini-1.5-flash-latest", "gemini-1.5-pro-exp-0801", + "gemini-1.5-pro-exp-0827", + "gemini-1.5-flash-exp-0827", + "gemini-1.5-flash-8b-exp-0827", ]; return validModels.includes(modelName); } diff --git a/server/utils/AiProviders/modelMap.js b/server/utils/AiProviders/modelMap.js index 151bd7cd8..b7604b69a 100644 --- a/server/utils/AiProviders/modelMap.js +++ b/server/utils/AiProviders/modelMap.js @@ -26,6 +26,9 @@ const MODEL_MAP = { "gemini-1.5-flash-latest": 1_048_576, "gemini-1.5-pro-latest": 2_097_152, "gemini-1.5-pro-exp-0801": 2_097_152, + "gemini-1.5-pro-exp-0827": 2_097_152, + "gemini-1.5-flash-exp-0827": 1_048_576, + "gemini-1.5-flash-8b-exp-0827": 1_048_576, }, groq: { "gemma2-9b-it": 8192, diff --git a/server/utils/helpers/updateENV.js b/server/utils/helpers/updateENV.js index af5a460db..bd29a746f 100644 --- a/server/utils/helpers/updateENV.js +++ b/server/utils/helpers/updateENV.js @@ -609,6 +609,9 @@ function validGeminiModel(input = "") { "gemini-1.5-pro-latest", "gemini-1.5-flash-latest", "gemini-1.5-pro-exp-0801", + "gemini-1.5-pro-exp-0827", + "gemini-1.5-flash-exp-0827", + "gemini-1.5-flash-8b-exp-0827", ]; return validModels.includes(input) ? null