@@ -596,9 +596,16 @@ async def test_stream_response_incomplete(openai_client, model, agenerator, alis
596596
597597
598598@pytest .mark .asyncio
599- async def test_stream_reasoning_content (openai_client , model , agenerator , alist ):
600- """Test that reasoning content (o1/o3 models) is streamed correctly."""
601- mock_reasoning_event = unittest .mock .Mock (type = "response.reasoning_text.delta" , delta = "Let me think..." )
599+ @pytest .mark .parametrize (
600+ "event_type" ,
601+ [
602+ "response.reasoning_text.delta" ,
603+ "response.reasoning_summary_text.delta" ,
604+ ],
605+ )
606+ async def test_stream_reasoning_content (openai_client , model , agenerator , alist , event_type ):
607+ """Test that reasoning content is streamed correctly for both full and summary reasoning events."""
608+ mock_reasoning_event = unittest .mock .Mock (type = event_type , delta = "Let me think..." )
602609 mock_text_event = unittest .mock .Mock (type = "response.output_text.delta" , delta = "The answer is 42" )
603610 mock_complete_event = unittest .mock .Mock (
604611 type = "response.completed" ,
@@ -1152,3 +1159,34 @@ async def test_stream_stateful(openai_client, model_id, agenerator, alist):
11521159 "usage" : {"inputTokens" : 10 , "outputTokens" : 5 , "totalTokens" : 15 },
11531160 "metrics" : {"latencyMs" : 0 },
11541161 }
1162+
1163+
1164+ def test_format_request_messages_excludes_reasoning_content (caplog ):
1165+ """Test that reasoningContent blocks are filtered from messages with a warning."""
1166+ messages = [
1167+ {
1168+ "content" : [{"text" : "Hello" }],
1169+ "role" : "user" ,
1170+ },
1171+ {
1172+ "content" : [
1173+ {"reasoningContent" : {"reasoningText" : {"text" : "Let me think..." }}},
1174+ {"text" : "The answer is 42" },
1175+ ],
1176+ "role" : "assistant" ,
1177+ },
1178+ {
1179+ "content" : [{"text" : "Thanks" }],
1180+ "role" : "user" ,
1181+ },
1182+ ]
1183+
1184+ with caplog .at_level ("WARNING" ):
1185+ result = OpenAIResponsesModel ._format_request_messages (messages )
1186+
1187+ assert result == [
1188+ {"role" : "user" , "content" : [{"type" : "input_text" , "text" : "Hello" }]},
1189+ {"role" : "assistant" , "content" : [{"type" : "output_text" , "text" : "The answer is 42" }]},
1190+ {"role" : "user" , "content" : [{"type" : "input_text" , "text" : "Thanks" }]},
1191+ ]
1192+ assert "reasoningContent is not yet supported" in caplog .text
0 commit comments