Skip to content

Commit

Permalink
refactor: (models) use regex for model ID filtering in OpenAIChatBot
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeikang committed Dec 26, 2024
1 parent 1e6aec9 commit 006fac7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import logging
import os
import re
from functools import cache

import anthropic
Expand Down Expand Up @@ -347,7 +348,7 @@ async def get_models(self):
openai_models = (await self.openai_client.models.list()).data
models = []
for model in openai_models:
if not model.id.startswith("gpt-4") and not model.id.startswith("o"):
if not re.match(r"gpt-\d", model.id) and not re.match(r"o\d", model.id):
# skip other models
logger.debug(f"Skipping model: {model.id}")
continue
Expand Down

0 comments on commit 006fac7

Please sign in to comment.