Merge pull request #510 from lmtr0/main

Support for more openai models
This commit is contained in:
Tim Jaeryang Baek 2025-04-18 18:08:44 -07:00 committed by GitHub
commit 9901e3de77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -59,6 +59,13 @@ class Pipeline:
f"{self.valves.OPENAI_API_BASE_URL}/models", headers=headers
)
allowed_models = [
"gpt",
"o1",
"o3",
"o4",
]
models = r.json()
return [
{
@ -66,7 +73,7 @@ class Pipeline:
"name": model["name"] if "name" in model else model["id"],
}
for model in models["data"]
if "gpt" in model["id"] or "o1" in model["id"] or "o3" in model["id"]
if any(substring in model["id"] for substring in allowed_models)
]
except Exception as e: