From 46866445f3afba2a4e0607a1d53e9b6fd8be6734 Mon Sep 17 00:00:00 2001 From: Matos Date: Thu, 1 Oct 2026 18:40:51 +0000 Subject: [PATCH] Allow the none reasoning effort for GPT-6 Luna (#183922) --- .../openai_conversation/config_flow.py | 1 + .../snapshots/test_conversation.ambr | 40 +++++++++++++++++++ .../openai_conversation/test_config_flow.py | 37 +++++++++++++++++ .../openai_conversation/test_conversation.py | 7 ++++ 4 files changed, 85 insertions(+) diff --git a/homeassistant/components/openai_conversation/config_flow.py b/homeassistant/components/openai_conversation/config_flow.py index fcef2c2a8f2b..a851c4e2522d 100644 --- a/homeassistant/components/openai_conversation/config_flow.py +++ b/homeassistant/components/openai_conversation/config_flow.py @@ -629,6 +629,7 @@ class OpenAISubentryFlowHandler(ConfigSubentryFlow): return [] models_reasoning_map: dict[str | tuple[str, ...], list[str]] = { + "gpt-6-luna": ["none", "low", "medium", "high", "xhigh", "max"], "gpt-6": ["low", "medium", "high", "xhigh", "max"], "gpt-5.6": ["none", "low", "medium", "high", "xhigh", "max"], ("gpt-5.2-pro", "gpt-5.4-pro", "gpt-5.5-pro"): ["medium", "high", "xhigh"], diff --git a/tests/components/openai_conversation/snapshots/test_conversation.ambr b/tests/components/openai_conversation/snapshots/test_conversation.ambr index b6c08393fa67..c9a9b56a560a 100644 --- a/tests/components/openai_conversation/snapshots/test_conversation.ambr +++ b/tests/components/openai_conversation/snapshots/test_conversation.ambr @@ -529,6 +529,46 @@ }), }) # --- +# name: test_model_args[subentry_options7] + dict({ + 'max_output_tokens': 3000, + 'model': 'gpt-6-luna', + 'prompt_cache_options': dict({ + 'ttl': '30m', + }), + 'reasoning': dict({ + 'effort': 'low', + 'summary': 'auto', + }), + 'service_tier': 'auto', + 'store': False, + 'stream': True, + 'text': dict({ + 'verbosity': 'medium', + }), + }) +# --- +# name: test_model_args[subentry_options8] + dict({ + 'max_output_tokens': 3000, + 'model': 'gpt-6-luna', + 'prompt_cache_options': dict({ + 'ttl': '30m', + }), + 'reasoning': dict({ + 'effort': 'none', + 'summary': 'auto', + }), + 'service_tier': 'auto', + 'store': False, + 'stream': True, + 'temperature': 0.5, + 'text': dict({ + 'verbosity': 'medium', + }), + 'top_p': 0.9, + }) +# --- # name: test_web_search[False] list([ dict({ diff --git a/tests/components/openai_conversation/test_config_flow.py b/tests/components/openai_conversation/test_config_flow.py index e47a93fada71..82d55d32df39 100644 --- a/tests/components/openai_conversation/test_config_flow.py +++ b/tests/components/openai_conversation/test_config_flow.py @@ -275,6 +275,7 @@ async def test_subentry_unsupported_model( ("gpt-5.5", ["none", "low", "medium", "high", "xhigh"]), ("gpt-5.5-pro", ["medium", "high", "xhigh"]), ("gpt-5.6", ["none", "low", "medium", "high", "xhigh", "max"]), + ("gpt-6-luna", ["none", "low", "medium", "high", "xhigh", "max"]), ("gpt-6-astra", ["low", "medium", "high", "xhigh", "max"]), ], ) @@ -320,6 +321,42 @@ async def test_subentry_reasoning_effort_list( ) +@pytest.mark.usefixtures("mock_init_component") +@pytest.mark.parametrize("subentry_type", ["conversation", "ai_task_data"]) +@pytest.mark.parametrize("reasoning_effort", ["none", "low"]) +async def test_subentry_luna_reasoning_effort( + hass: HomeAssistant, + mock_config_entry: MockConfigEntry, + subentry_type: str, + reasoning_effort: str, +) -> None: + """Test that Luna reasoning effort can be selected and saved.""" + subentry = next( + entry + for entry in mock_config_entry.subentries.values() + if entry.subentry_type == subentry_type + ) + result = await mock_config_entry.start_subentry_reconfigure_flow( + hass, subentry.subentry_id + ) + result = await hass.config_entries.subentries.async_configure( + result["flow_id"], {CONF_RECOMMENDED: False} + ) + result = await hass.config_entries.subentries.async_configure( + result["flow_id"], {CONF_CHAT_MODEL: "gpt-6-luna"} + ) + assert result["step_id"] == "model" + + result = await hass.config_entries.subentries.async_configure( + result["flow_id"], {CONF_REASONING_EFFORT: reasoning_effort} + ) + assert result["type"] is FlowResultType.ABORT + assert result["reason"] == "reconfigure_successful" + saved = mock_config_entry.subentries[subentry.subentry_id].data + assert saved[CONF_CHAT_MODEL] == "gpt-6-luna" + assert saved[CONF_REASONING_EFFORT] == reasoning_effort + + @pytest.mark.parametrize( ("model", "has_reasoning_summary"), [ diff --git a/tests/components/openai_conversation/test_conversation.py b/tests/components/openai_conversation/test_conversation.py index 723d3d03e8f1..0fccf58b3853 100644 --- a/tests/components/openai_conversation/test_conversation.py +++ b/tests/components/openai_conversation/test_conversation.py @@ -879,6 +879,13 @@ async def test_flex_tier_retry( CONF_REASONING_SUMMARY: "off", CONF_VERBOSITY: "high", }, + {CONF_CHAT_MODEL: "gpt-6-luna"}, + { + CONF_CHAT_MODEL: "gpt-6-luna", + CONF_REASONING_EFFORT: "none", + CONF_TEMPERATURE: 0.5, + CONF_TOP_P: 0.9, + }, ], ) @pytest.mark.usefixtures("mock_init_component")