💬 fix: adjust regex in ModelService to recognize o1 models

API query for OpenAI returns list of models. Their names are filtered using a regex. The regex did not yet account for model names starting with o1-
This commit is contained in:
Jürgen Walter 2024-10-07 19:33:43 +02:00 committed by GitHub
parent 519df46e1f
commit 5da7766fad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -157,7 +157,7 @@ const fetchOpenAIModels = async (opts, _models = []) => {
} }
if (baseURL === openaiBaseURL) { if (baseURL === openaiBaseURL) {
const regex = /(text-davinci-003|gpt-)/; const regex = /(text-davinci-003|gpt-|o1-)/;
models = models.filter((model) => regex.test(model)); models = models.filter((model) => regex.test(model));
const instructModels = models.filter((model) => model.includes('instruct')); const instructModels = models.filter((model) => model.includes('instruct'));
const otherModels = models.filter((model) => !model.includes('instruct')); const otherModels = models.filter((model) => !model.includes('instruct'));