mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
fix(o-series): generalize is_model_o_series_model to match any o+digit prefix
Replace the hardcoded startswith(("o1", "o3", "o4")) check with a broader
o+digit pattern, ensuring future o-series models (e.g. o2, o5) are
automatically recognized once added to open_ai_chat_completion_models.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
cdf2d67fc8
commit
dd0ccdd8b2
1 changed files with 4 additions and 1 deletions
|
|
@ -131,7 +131,10 @@ class OpenAIOSeriesConfig(OpenAIGPTConfig):
|
|||
|
||||
def is_model_o_series_model(self, model: str) -> bool:
|
||||
model = model.split("/")[-1] # could be "openai/o3" or "o3"
|
||||
return model.startswith(("o1", "o3", "o4")) and model in litellm.open_ai_chat_completion_models
|
||||
return (
|
||||
len(model) > 1 and model[0] == "o" and model[1].isdigit()
|
||||
and model in litellm.open_ai_chat_completion_models
|
||||
)
|
||||
|
||||
@overload
|
||||
def _transform_messages(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue