@@ -226,6 +226,9 @@ def test_reasoning_model_token_parameter():
226226 ("openai/o1-2023-01-01" , True ),
227227 ("openai/o3" , True ),
228228 ("openai/o3-mini-2023-01-01" , True ),
229+ ("openai/gpt-5" , True ),
230+ ("openai/gpt-5-mini" , True ),
231+ ("openai/gpt-5-nano" , True ),
229232 ("openai/gpt-4" , False ),
230233 ("anthropic/claude-2" , False ),
231234 ]
@@ -245,19 +248,22 @@ def test_reasoning_model_token_parameter():
245248 assert "max_tokens" in lm .kwargs
246249 assert lm .kwargs ["max_tokens" ] == 1000
247250
248-
249- def test_reasoning_model_requirements ():
251+ @ pytest . mark . parametrize ( "model_name" , [ "openai/o1" , "openai/gpt-5-nano" ])
252+ def test_reasoning_model_requirements (model_name ):
250253 # Should raise assertion error if temperature or max_tokens requirements not met
251- with pytest .raises (ValueError , match = "reasoning models require passing temperature=1.0 and max_tokens >= 20000" ):
254+ with pytest .raises (
255+ ValueError ,
256+ match = "reasoning models require passing temperature=1.0 and max_tokens >= 20000" ,
257+ ):
252258 dspy .LM (
253- model = "openai/o1" ,
259+ model = model_name ,
254260 temperature = 0.7 , # Should be 1.0
255261 max_tokens = 1000 , # Should be >= 20_000
256262 )
257263
258264 # Should pass with correct parameters
259265 lm = dspy .LM (
260- model = "openai/o1" ,
266+ model = model_name ,
261267 temperature = 1.0 ,
262268 max_tokens = 20_000 ,
263269 )
0 commit comments