From d07f3ae082ea711e0db92a4b6dfd37421373f33d Mon Sep 17 00:00:00 2001 From: Aiman Farooq <3269808+AimanFarooq@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:44:36 -0800 Subject: [PATCH] Add minimal to OpenAI reasoning effort options Reasoning models such as OpenAI's gpt-5 family and Meta's Muse Spark accept reasoning_effort=minimal, which roughly halves first-text latency for short voice-assistant answers compared to low. The provider already forwards any value other than none, so only the selector options, labels and a test change. Closes #7 --- custom_components/configurable_llm/const.py | 2 +- custom_components/configurable_llm/strings.json | 1 + custom_components/configurable_llm/translations/en.json | 1 + tests/providers/test_openai_chat_provider.py | 8 ++++++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/custom_components/configurable_llm/const.py b/custom_components/configurable_llm/const.py index 99ec8cc..10207c6 100644 --- a/custom_components/configurable_llm/const.py +++ b/custom_components/configurable_llm/const.py @@ -26,7 +26,7 @@ # `reasoning_effort` choices offered for OpenAI-compatible providers. Servers and # models vary in what they accept; "none" means "do not send the parameter". -REASONING_EFFORT_OPTIONS = ["none", "low", "medium", "high"] +REASONING_EFFORT_OPTIONS = ["none", "minimal", "low", "medium", "high"] CONF_WEB_FETCH_MAX_USES = "web_fetch_max_uses" CONF_WEB_SEARCH = "web_search" diff --git a/custom_components/configurable_llm/strings.json b/custom_components/configurable_llm/strings.json index 7bf7453..3727e94 100644 --- a/custom_components/configurable_llm/strings.json +++ b/custom_components/configurable_llm/strings.json @@ -245,6 +245,7 @@ "reasoning_effort": { "options": { "none": "Default (none)", + "minimal": "Minimal", "low": "Low", "medium": "Medium", "high": "High" diff --git a/custom_components/configurable_llm/translations/en.json b/custom_components/configurable_llm/translations/en.json index 7bf7453..3727e94 100644 --- a/custom_components/configurable_llm/translations/en.json +++ b/custom_components/configurable_llm/translations/en.json @@ -245,6 +245,7 @@ "reasoning_effort": { "options": { "none": "Default (none)", + "minimal": "Minimal", "low": "Low", "medium": "Medium", "high": "High" diff --git a/tests/providers/test_openai_chat_provider.py b/tests/providers/test_openai_chat_provider.py index 9a085a1..66eba1b 100644 --- a/tests/providers/test_openai_chat_provider.py +++ b/tests/providers/test_openai_chat_provider.py @@ -409,6 +409,14 @@ async def test_build_request_sampling_params(hass: HomeAssistant) -> None: assert "reasoning_effort" not in request +async def test_build_request_reasoning_effort_minimal(hass: HomeAssistant) -> None: + """'minimal' effort is forwarded verbatim, not treated like 'none'.""" + options = {**DEFAULT_OPENAI, CONF_REASONING_EFFORT: "minimal"} + request, _ = await provider.build_request(_ctx(options=options)) + + assert request["reasoning_effort"] == "minimal" + + async def test_build_request_tools(hass: HomeAssistant) -> None: """HA tools become Chat Completions function tools.""" request, _ = await provider.build_request(_ctx(with_tools=True))