Skip to content

Commit c490cc2

Browse files
Xmaderalbertvillanova
authored andcommitted
Fix error for GPT-5 not supporting the stop parameter (#1662)
1 parent 420eaeb commit c490cc2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/smolagents/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def supports_stop_parameter(model_id: str) -> bool:
359359
"""
360360
Check if the model supports the `stop` parameter.
361361
362-
Not supported with reasoning models openai/o3 and openai/o4-mini (and their versioned variants).
362+
Not supported with reasoning models openai/o3, openai/o4-mini, and the openai/gpt-5 series (and their versioned variants).
363363
364364
Args:
365365
model_id (`str`): Model identifier (e.g. "openai/o3", "o4-mini-2025-04-16")
@@ -368,8 +368,8 @@ def supports_stop_parameter(model_id: str) -> bool:
368368
bool: True if the model supports the stop parameter, False otherwise
369369
"""
370370
model_name = model_id.split("/")[-1]
371-
# o3 and o4-mini (including versioned variants, o3-2025-04-16) don't support stop parameter
372-
pattern = r"^(o3[-\d]*|o4-mini[-\d]*)$"
371+
# o3, o4-mini, and the gpt-5 series (including versioned variants, o3-2025-04-16) don't support stop parameter
372+
pattern = r"^(o3[-\d]*|o4-mini[-\d]*|gpt-5(-mini|-nano)?[-\d]*)$"
373373
return not re.match(pattern, model_name)
374374

375375

0 commit comments

Comments
 (0)