diff --git a/custom_components/anthropic_custom/const.py b/custom_components/anthropic_custom/const.py index b68b00a..fdf2427 100644 --- a/custom_components/anthropic_custom/const.py +++ b/custom_components/anthropic_custom/const.py @@ -31,7 +31,7 @@ DEFAULT = { CONF_MAX_TOKENS: 3000, CONF_TEMPERATURE: 1.0, CONF_THINKING_BUDGET: 0, - CONF_THINKING_EFFORT: "low", + CONF_THINKING_EFFORT: "medium", CONF_WEB_SEARCH: False, CONF_WEB_SEARCH_USER_LOCATION: False, CONF_WEB_SEARCH_MAX_USES: 5, diff --git a/custom_components/anthropic_custom/entity.py b/custom_components/anthropic_custom/entity.py index 7ca512a..bb6abc2 100644 --- a/custom_components/anthropic_custom/entity.py +++ b/custom_components/anthropic_custom/entity.py @@ -694,6 +694,11 @@ class AnthropicBaseLLMEntity(Entity): thinking_effort = options.get( CONF_THINKING_EFFORT, DEFAULT[CONF_THINKING_EFFORT] ) + # Some models (e.g. *-think variants) require minimum effort of "medium" + _EFFORT_ORDER = ["low", "medium", "high", "max"] + if "think" in model and thinking_effort in _EFFORT_ORDER: + if _EFFORT_ORDER.index(thinking_effort) < _EFFORT_ORDER.index("medium"): + thinking_effort = "medium" if thinking_effort != "none": model_args["thinking"] = ThinkingConfigAdaptiveParam(type="adaptive") model_args["output_config"] = OutputConfigParam(effort=thinking_effort)