From 9a569fdc6a1cc1f31d5cc8a4d74fd1165b43c4da Mon Sep 17 00:00:00 2001 From: Xubin Ren Date: Fri, 17 Apr 2026 12:26:03 +0000 Subject: [PATCH] style: collapse should_execute_tools docstring to one line Made-with: Cursor --- nanobot/providers/base.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/nanobot/providers/base.py b/nanobot/providers/base.py index f017bd3c4..d41115d23 100644 --- a/nanobot/providers/base.py +++ b/nanobot/providers/base.py @@ -73,17 +73,7 @@ class LLMResponse: @property def should_execute_tools(self) -> bool: - """Check if tool calls should be executed (guards against gateway injection). - - Executes only when ``has_tool_calls`` is true and ``finish_reason`` is one of - the known-good signals: ``"tool_calls"`` (explicit intent) or ``"stop"`` (some - compliant providers emit ``stop`` for legitimate tool calls; existing paths in - ``openai_compat_provider`` already treat both as the tool-call terminal state). - - Tool calls under any other ``finish_reason`` (e.g. ``refusal``, ``content_filter``, - ``error``) are treated as anomalous — typically injected by non-compliant API - gateways — and are skipped. - """ + """True only if tool_calls present AND finish_reason is a known-good signal (``tool_calls`` or ``stop``); blocks gateway-injected calls under ``refusal`` / ``content_filter`` / ``error``.""" if not self.has_tool_calls: return False return self.finish_reason in ("tool_calls", "stop")