Skip to content

Commit

Permalink
feat(model): remove deprecated models
Browse files Browse the repository at this point in the history
  • Loading branch information
RubuJam authored Jul 22, 2024
1 parent a74b508 commit 9f3e87a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
5 changes: 5 additions & 0 deletions app/api/google/[...path]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 0 additions & 6 deletions app/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,21 +197,16 @@ export const KnowledgeCutOffDate: Record<string, string> = {
"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",
Expand All @@ -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 = [
Expand Down
15 changes: 2 additions & 13 deletions app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

0 comments on commit 9f3e87a

Please sign in to comment.