From f5d9586f1fada63f67201883025672fa010c304c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Fri, 1 Nov 2024 13:39:05 +0100 Subject: [PATCH] fix: disable computer tool unless explicitly enabled --- gptme/tools/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gptme/tools/__init__.py b/gptme/tools/__init__.py index de0df81a..351adb84 100644 --- a/gptme/tools/__init__.py +++ b/gptme/tools/__init__.py @@ -50,6 +50,12 @@ ] loaded_tools: list[ToolSpec] = [] +# Tools that are disabled by default, unless explicitly enabled +# TODO: find a better way to handle this +tools_default_disabled = [ + "computer", +] + def init_tools(allowlist=None) -> None: """Runs initialization logic for tools.""" @@ -62,6 +68,9 @@ def init_tools(allowlist=None) -> None: continue if tool in loaded_tools: continue + if tool.name in tools_default_disabled: + if not allowlist or tool.name not in allowlist: + continue load_tool(tool) for tool_name in allowlist or []: