Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.
Python agentsai-hackingai-penetration-testingai-pentestingai-securityartificial-intelligencebug-bountycode-qualityctf-toolscybersecuritycybersecurity-toolsethical-hackinghackingllm-securityoffensive-securitypenetration-testingpentesting-toolsred-teamingsecuritysecurity-automation
Drop tool_choice for registry-unknown reasoning-effort runs
0xallam712c64f6300d
diff --git a/strix/config/models.py b/strix/config/models.pyindex 59a52a48..83f8e914 100644--- a/strix/config/models.py+++ b/strix/config/models.py@@ -121,7 +121,7 @@ def uses_chat_completions_tool_schema(model_name: str, settings: Settings) -> boreturn bool(settings.llm.api_base)-def model_supports_reasoning(model_name: str) -> bool:+def _model_cost_entry(model_name: str) -> dict[str, object] | None:import litellmname = model_name.strip().lower()@@ -132,4 +132,13 @@ def model_supports_reasoning(model_name: str) -> bool:entry = litellm.model_cost.get(name)if entry is None and "/" in name:entry = litellm.model_cost.get(name.rsplit("/", 1)[1])+ return entry+++def model_supports_reasoning(model_name: str) -> bool:+ entry = _model_cost_entry(model_name)return bool(entry and entry.get("supports_reasoning"))+++def model_known_to_registry(model_name: str) -> bool:+ return _model_cost_entry(model_name) is not Nonediff --git a/strix/core/inputs.py b/strix/core/inputs.pyindex 148bf09b..58da3e60 100644--- a/strix/core/inputs.py+++ b/strix/core/inputs.py@@ -8,7 +8,11 @@ from typing import TYPE_CHECKING, Anyfrom agents.model_settings import ModelSettingsfrom openai.types.shared import Reasoning-from strix.config.models import DEFAULT_MODEL_RETRY, model_supports_reasoning+from strix.config.models import (+ DEFAULT_MODEL_RETRY,+ model_known_to_registry,+ model_supports_reasoning,+)if TYPE_CHECKING:@@ -111,23 +115,25 @@ def make_model_settings(*,model_name: str,) -> ModelSettings:- # Anthropic + DeepSeek thinking reject ``tool_choice="required"`` outright- # when reasoning is enabled; OpenAI o-series accepts both but doesn't need- # the safety net. When reasoning is on we let the model self-select tools- # and rely on the system prompt + the ``_finish_tool_use_behavior`` callback- # to keep the loop converging on a lifecycle tool.- use_reasoning = (- reasoning_effort is not None- and reasoning_effort != "none"- and model_supports_reasoning(model_name)+ # Anthropic + DeepSeek thinking reject ``tool_choice="required"`` outright;+ # when reasoning is enabled we let the model self-select tools and rely on+ # the system prompt + the ``_finish_tool_use_behavior`` callback to keep+ # the loop converging. When the user opted into reasoning but the model+ # is unknown to LiteLLM's registry (e.g. a private DeepSeek SKU, a fresh+ # release the registry hasn't picked up), drop ``tool_choice`` too —+ # server-side thinking-mode endpoints reject it and we can't confirm.+ user_wants_reasoning = reasoning_effort is not None and reasoning_effort != "none"+ confirmed_reasoning = model_supports_reasoning(model_name)+ drop_tool_choice = user_wants_reasoning and (+ confirmed_reasoning or not model_known_to_registry(model_name))model_settings = ModelSettings(parallel_tool_calls=False,- tool_choice=None if use_reasoning else "required",+ tool_choice=None if drop_tool_choice else "required",retry=DEFAULT_MODEL_RETRY,include_usage=True,)- if use_reasoning:+ if user_wants_reasoning and confirmed_reasoning:model_settings = model_settings.resolve(ModelSettings(reasoning=Reasoning(effort=reasoning_effort)),)