Skip to content

Commit

Permalink
update chat model filters for openai (#2803)
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycarambat authored Dec 11, 2024
1 parent a0c5d89 commit a69997a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion server/utils/AiProviders/openAi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions server/utils/helpers/customModels.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a69997a

Please sign in to comment.