Skip to content
Snippets Groups Projects
Unverified Commit a69997a7 authored by Timothy Carambat's avatar Timothy Carambat Committed by GitHub
Browse files

update chat model filters for openai (#2803)

parent a0c5d898
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment