From ea2cf68807221c455f5d5809cfd2587167bb4160 Mon Sep 17 00:00:00 2001 From: Meet Patel <113581962+meetpateltech@users.noreply.github.com> Date: Thu, 18 Jul 2024 22:56:48 +0530 Subject: [PATCH 1/5] added openai gpt4o mini model --- lib/chat-setting-limits.ts | 6 ++++++ lib/models/llm/openai-llm-list.ts | 16 ++++++++++++++++ types/llms.ts | 1 + 3 files changed, 23 insertions(+) diff --git a/lib/chat-setting-limits.ts b/lib/chat-setting-limits.ts index c802bd657b..9af8fa9092 100644 --- a/lib/chat-setting-limits.ts +++ b/lib/chat-setting-limits.ts @@ -157,6 +157,12 @@ export const CHAT_SETTING_LIMITS: Record = { MAX_TOKEN_OUTPUT_LENGTH: 4096, MAX_CONTEXT_LENGTH: 128000 }, + "gpt-4o-mini": { + MIN_TEMPERATURE: 0.0, + MAX_TEMPERATURE: 2.0, + MAX_TOKEN_OUTPUT_LENGTH: 4096, + MAX_CONTEXT_LENGTH: 128000 + }, // PERPLEXITY MODELS "pplx-7b-online": { diff --git a/lib/models/llm/openai-llm-list.ts b/lib/models/llm/openai-llm-list.ts index 48823ab981..55df79a53d 100644 --- a/lib/models/llm/openai-llm-list.ts +++ b/lib/models/llm/openai-llm-list.ts @@ -3,6 +3,22 @@ import { LLM } from "@/types" const OPENAI_PLATORM_LINK = "https://platform.openai.com/docs/overview" // OpenAI Models (UPDATED 1/25/24) ----------------------------- + +const GPT4oMini: LLM = { + modelId: "gpt-4o-mini", + modelName: "GPT-4o Mini", + provider: "openai", + hostedId: "gpt-4o-mini", + platformLink: OPENAI_PLATORM_LINK, + imageInput: true, + pricing: { + currency: "USD", + unit: "1M tokens", + inputCost: 0.15, + outputCost: 0.6 + } +} + const GPT4o: LLM = { modelId: "gpt-4o", modelName: "GPT-4o", diff --git a/types/llms.ts b/types/llms.ts index 6f89acf612..116da93db5 100644 --- a/types/llms.ts +++ b/types/llms.ts @@ -10,6 +10,7 @@ export type LLMID = // OpenAI Models (UPDATED 5/13/24) export type OpenAILLMID = + | "gpt-4o-mini" // GPT-4o Mini | "gpt-4o" // GPT-4o | "gpt-4-turbo-preview" // GPT-4 Turbo | "gpt-4-vision-preview" // GPT-4 Vision From 6256a11620b3288e4539e6aecadc32d92d1e5706 Mon Sep 17 00:00:00 2001 From: Meet Patel <113581962+meetpateltech@users.noreply.github.com> Date: Thu, 18 Jul 2024 22:58:24 +0530 Subject: [PATCH 2/5] Update openai-llm-list.ts --- lib/models/llm/openai-llm-list.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/models/llm/openai-llm-list.ts b/lib/models/llm/openai-llm-list.ts index 55df79a53d..f0dc0f76d1 100644 --- a/lib/models/llm/openai-llm-list.ts +++ b/lib/models/llm/openai-llm-list.ts @@ -98,6 +98,7 @@ const GPT3_5Turbo: LLM = { } export const OPENAI_LLM_LIST: LLM[] = [ + GPT4oMini, GPT4o, GPT4Turbo, GPT4Vision, From 6d3e97f603b8e42eae6d82bfd1bec0225ecf22ea Mon Sep 17 00:00:00 2001 From: Meet Patel <113581962+meetpateltech@users.noreply.github.com> Date: Thu, 18 Jul 2024 23:12:52 +0530 Subject: [PATCH 3/5] fix image response output --- app/api/chat/openai/route.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/api/chat/openai/route.ts b/app/api/chat/openai/route.ts index a0f8ad0c93..aeabc0e6d3 100644 --- a/app/api/chat/openai/route.ts +++ b/app/api/chat/openai/route.ts @@ -30,7 +30,8 @@ export async function POST(request: Request) { temperature: chatSettings.temperature, max_tokens: chatSettings.model === "gpt-4-vision-preview" || - chatSettings.model === "gpt-4o" + chatSettings.model === "gpt-4o" || + chatSettings.model === "gpt-4o-mini" ? 4096 : null, // TODO: Fix stream: true From f1f45a2d51fb61d67483b782ceb918f36787a2dc Mon Sep 17 00:00:00 2001 From: Meet Patel <113581962+meetpateltech@users.noreply.github.com> Date: Fri, 19 Jul 2024 08:53:22 +0530 Subject: [PATCH 4/5] fix output token size --- app/api/chat/openai/route.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/api/chat/openai/route.ts b/app/api/chat/openai/route.ts index aeabc0e6d3..3a77f3601a 100644 --- a/app/api/chat/openai/route.ts +++ b/app/api/chat/openai/route.ts @@ -30,10 +30,11 @@ export async function POST(request: Request) { temperature: chatSettings.temperature, max_tokens: chatSettings.model === "gpt-4-vision-preview" || - chatSettings.model === "gpt-4o" || - chatSettings.model === "gpt-4o-mini" + chatSettings.model === "gpt-4o" ? 4096 - : null, // TODO: Fix + : chatSettings.model === "gpt-4o-mini" + ? 16383 + : null, stream: true }) From b1fc87861a630a1aaf0ca293e7e5e3dce5743cba Mon Sep 17 00:00:00 2001 From: Meet Patel <113581962+meetpateltech@users.noreply.github.com> Date: Sun, 21 Jul 2024 09:07:46 +0530 Subject: [PATCH 5/5] Update chat-setting-limits.ts update output token in gpt4o mini --- lib/chat-setting-limits.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/chat-setting-limits.ts b/lib/chat-setting-limits.ts index 9af8fa9092..698630f925 100644 --- a/lib/chat-setting-limits.ts +++ b/lib/chat-setting-limits.ts @@ -160,7 +160,7 @@ export const CHAT_SETTING_LIMITS: Record = { "gpt-4o-mini": { MIN_TEMPERATURE: 0.0, MAX_TEMPERATURE: 2.0, - MAX_TOKEN_OUTPUT_LENGTH: 4096, + MAX_TOKEN_OUTPUT_LENGTH: 16383, MAX_CONTEXT_LENGTH: 128000 },