🔧 refactor: Revamp Model and Tool Filtering Logic (#5637)

* 🔧 fix: Update regex to correctly match OpenAI model identifiers

* 🔧 fix: Enhance tool filtering logic in ToolService to handle inclusion and exclusion criteria for basic tools and toolkits

* feat: support o3-mini Azure streaming

* chore: Update model filtering logic to exclude audio and realtime models

* ci: linting error
This commit is contained in:
Danny Avila 2025-02-03 16:08:34 -05:00 committed by GitHub
parent 7c8a930061
commit 0312d4f4f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 28 additions and 14 deletions

View file

@ -159,8 +159,9 @@ const fetchOpenAIModels = async (opts, _models = []) => {
}
if (baseURL === openaiBaseURL) {
const regex = /(text-davinci-003|gpt-|o1-)/;
models = models.filter((model) => regex.test(model));
const regex = /(text-davinci-003|gpt-|o\d+-)/;
const excludeRegex = /audio|realtime/;
models = models.filter((model) => regex.test(model) && !excludeRegex.test(model));
const instructModels = models.filter((model) => model.includes('instruct'));
const otherModels = models.filter((model) => !model.includes('instruct'));
models = otherModels.concat(instructModels);