@@ -535,14 +535,82 @@ def test_run_with_flattened_generation_kwargs(self, openai_mock_responses, monke
535535 monkeypatch .setenv ("OPENAI_API_KEY" , "test-api-key" )
536536 chat_messages = [ChatMessage .from_user ("What's the capital of France" )]
537537 component = OpenAIResponsesChatGenerator (
538- model = "gpt-4" ,
539- generation_kwargs = {"reasoning_effort" : "low" , "reasoning_summary" : "auto" , "verbosity" : "low" },
538+ model = "gpt-5.6-luna" ,
539+ generation_kwargs = {
540+ "reasoning_effort" : "low" ,
541+ "reasoning_summary" : "auto" ,
542+ "reasoning_mode" : "pro" ,
543+ "verbosity" : "low" ,
544+ },
540545 )
541546 results = component .run (chat_messages )
542547 assert len (results ["replies" ]) == 1
543- assert openai_mock_responses .call_args .kwargs ["reasoning" ] == {"effort" : "low" , "summary" : "auto" }
548+ assert openai_mock_responses .call_args .kwargs ["reasoning" ] == {
549+ "effort" : "low" ,
550+ "summary" : "auto" ,
551+ "mode" : "pro" ,
552+ }
544553 assert openai_mock_responses .call_args .kwargs ["text" ] == {"verbosity" : "low" }
545554
555+ def test_run_with_reasoning_mode_only (self , openai_mock_responses , monkeypatch ):
556+ monkeypatch .setenv ("OPENAI_API_KEY" , "test-api-key" )
557+ chat_messages = [ChatMessage .from_user ("What's the capital of France" )]
558+ component = OpenAIResponsesChatGenerator (model = "gpt-5.6-luna" , generation_kwargs = {"reasoning_mode" : "standard" })
559+ results = component .run (chat_messages )
560+ assert len (results ["replies" ]) == 1
561+ assert openai_mock_responses .call_args .kwargs ["reasoning" ] == {"mode" : "standard" }
562+
563+ def test_run_with_reasoning_mode_merges_with_existing_reasoning_dict (self , openai_mock_responses , monkeypatch ):
564+ monkeypatch .setenv ("OPENAI_API_KEY" , "test-api-key" )
565+ chat_messages = [ChatMessage .from_user ("What's the capital of France" )]
566+ component = OpenAIResponsesChatGenerator (
567+ model = "gpt-5.6-luna" , generation_kwargs = {"reasoning" : {"effort" : "high" }, "reasoning_mode" : "pro" }
568+ )
569+ results = component .run (chat_messages )
570+ assert len (results ["replies" ]) == 1
571+ assert openai_mock_responses .call_args .kwargs ["reasoning" ] == {"effort" : "high" , "mode" : "pro" }
572+
573+ def test_run_with_include_reasoning_encrypted_content (self , openai_mock_responses , monkeypatch ):
574+ monkeypatch .setenv ("OPENAI_API_KEY" , "test-api-key" )
575+ chat_messages = [ChatMessage .from_user ("What's the capital of France" )]
576+ component = OpenAIResponsesChatGenerator (
577+ model = "gpt-5.6-luna" , generation_kwargs = {"include_reasoning_encrypted_content" : True }
578+ )
579+ results = component .run (chat_messages )
580+ assert len (results ["replies" ]) == 1
581+ assert openai_mock_responses .call_args .kwargs ["include" ] == ["reasoning.encrypted_content" ]
582+
583+ def test_run_with_include_reasoning_encrypted_content_merges_with_existing_include_list (
584+ self , openai_mock_responses , monkeypatch
585+ ):
586+ monkeypatch .setenv ("OPENAI_API_KEY" , "test-api-key" )
587+ chat_messages = [ChatMessage .from_user ("What's the capital of France" )]
588+ component = OpenAIResponsesChatGenerator (
589+ model = "gpt-5.6-luna" ,
590+ generation_kwargs = {
591+ "include" : ["message.output_text.logprobs" ],
592+ "include_reasoning_encrypted_content" : True ,
593+ },
594+ )
595+ results = component .run (chat_messages )
596+ assert len (results ["replies" ]) == 1
597+ assert openai_mock_responses .call_args .kwargs ["include" ] == [
598+ "message.output_text.logprobs" ,
599+ "reasoning.encrypted_content" ,
600+ ]
601+
602+ def test_run_with_include_reasoning_encrypted_content_false_does_not_set_include (
603+ self , openai_mock_responses , monkeypatch
604+ ):
605+ monkeypatch .setenv ("OPENAI_API_KEY" , "test-api-key" )
606+ chat_messages = [ChatMessage .from_user ("What's the capital of France" )]
607+ component = OpenAIResponsesChatGenerator (
608+ model = "gpt-5.6-luna" , generation_kwargs = {"include_reasoning_encrypted_content" : False }
609+ )
610+ results = component .run (chat_messages )
611+ assert len (results ["replies" ]) == 1
612+ assert "include" not in openai_mock_responses .call_args .kwargs
613+
546614 def test_run_with_params_streaming (self , openai_mock_responses_stream_text_delta ):
547615 streaming_callback_called = False
548616
0 commit comments