From 9f3e87a9715f9fa8103bf54835ca92f5d3f8b0d0 Mon Sep 17 00:00:00 2001 From: Rubu Jam Date: Mon, 22 Jul 2024 06:58:20 +0000 Subject: [PATCH] feat(model): remove deprecated models --- app/api/google/[...path]/route.ts | 5 +++++ app/constant.ts | 6 ------ app/utils.ts | 15 ++------------- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/app/api/google/[...path]/route.ts b/app/api/google/[...path]/route.ts index 83a7ce794c1..940362d04ed 100644 --- a/app/api/google/[...path]/route.ts +++ b/app/api/google/[...path]/route.ts @@ -57,6 +57,11 @@ export const GET = handle; export const POST = handle; export const runtime = "edge"; + +// due to Gemini-1.5-pro is not available in Hong Kong, we need to set the preferred region to exclude "Hong Kong (hkg1)". +// the paid service of the Gemini API is required in the following regions until 8 July 2024. The free service is not available. Therefore, the regions is temporarily disabled. +// regions include Dublin (dub1, Ireland), Paris (cdg1, France), Frankfurt (fra1, Germany), London (lhr1, UK), and Stockholm (arn1, Sweden). +// refs: https://ai.google.dev/gemini-api/docs/available-regions export const preferredRegion = [ "bom1", "cle1", diff --git a/app/constant.ts b/app/constant.ts index 0e3d76fac60..8df0ccc095b 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -197,21 +197,16 @@ export const KnowledgeCutOffDate: Record = { "gpt-4o-2024-05-13": "2023-10", "gpt-4o-mini": "2023-10", "gpt-4o-mini-2024-07-18": "2023-10", - "gpt-4-vision-preview": "2023-04", // After improvements, // it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously. "gemini-pro": "2023-12", - "gemini-pro-vision": "2023-12", }; const openaiModels = [ "gpt-3.5-turbo", "gpt-3.5-turbo-1106", - "gpt-3.5-turbo-0125", "gpt-4", - "gpt-4-0613", "gpt-4-32k", - "gpt-4-32k-0613", "gpt-4-turbo", "gpt-4-turbo-preview", "gpt-4o", @@ -227,7 +222,6 @@ const googleModels = [ "gemini-1.0-pro", "gemini-1.5-pro-latest", "gemini-1.5-flash-latest", - "gemini-pro-vision", ]; const anthropicModels = [ diff --git a/app/utils.ts b/app/utils.ts index 2f2c8ae95ab..8b169d45d02 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -250,18 +250,7 @@ export function getMessageImages(message: RequestMessage): string[] { export function isVisionModel(model: string) { // Note: This is a better way using the TypeScript feature instead of `&&` or `||` (ts v5.5.0-dev.20240314 I've been using) - const visionKeywords = [ - "vision", - "claude-3", - "gemini-1.5-pro", - "gemini-1.5-flash", - "gpt-4o", - "gpt-4o-mini", - ]; - const isGpt4Turbo = - model.includes("gpt-4-turbo") && !model.includes("preview"); + const visionKeywords = ["claude-3", "gemini-1.5", "gpt-4"]; - return ( - visionKeywords.some((keyword) => model.includes(keyword)) || isGpt4Turbo - ); + return visionKeywords.some((keyword) => model.includes(keyword)); }