From a69997a715f9201046c7b9baf9588cfb4c23bdb0 Mon Sep 17 00:00:00 2001 From: Timothy Carambat <rambat1010@gmail.com> Date: Wed, 11 Dec 2024 08:55:10 -0800 Subject: [PATCH] update chat model filters for openai (#2803) --- server/utils/AiProviders/openAi/index.js | 4 +++- server/utils/helpers/customModels.js | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/server/utils/AiProviders/openAi/index.js b/server/utils/AiProviders/openAi/index.js index 4f6bc2219..2829a5374 100644 --- a/server/utils/AiProviders/openAi/index.js +++ b/server/utils/AiProviders/openAi/index.js @@ -62,7 +62,9 @@ class OpenAiLLM { // we don't want to hit the OpenAI api every chat because it will get spammed // and introduce latency for no reason. async isValidChatCompletionModel(modelName = "") { - const isPreset = modelName.toLowerCase().includes("gpt"); + const isPreset = + modelName.toLowerCase().includes("gpt") || + modelName.toLowerCase().includes("o1"); if (isPreset) return true; const model = await this.openai.models diff --git a/server/utils/helpers/customModels.js b/server/utils/helpers/customModels.js index 35ab5570d..1361c5271 100644 --- a/server/utils/helpers/customModels.js +++ b/server/utils/helpers/customModels.js @@ -141,9 +141,17 @@ async function openAiModels(apiKey = null) { }); const gpts = allModels - .filter((model) => model.id.startsWith("gpt") || model.id.startsWith("o1")) .filter( - (model) => !model.id.includes("vision") && !model.id.includes("instruct") + (model) => + (model.id.includes("gpt") && !model.id.startsWith("ft:")) || + model.id.includes("o1") + ) + .filter( + (model) => + !model.id.includes("vision") && + !model.id.includes("instruct") && + !model.id.includes("audio") && + !model.id.includes("realtime") ) .map((model) => { return { -- GitLab