Improve static tools initialization safety (#324)

* improve static tools initialization safety

* Allow modification of custom_tools during code execution
This commit is contained in:
kingdomad 2025-01-23 16:43:49 +08:00 committed by GitHub
parent 7e9f6e5edb
commit b351a8c9ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 4 deletions

View File

@ -1266,10 +1266,8 @@ def evaluate_python_code(
if state is None:
state = {}
if static_tools is None:
static_tools = {}
if custom_tools is None:
custom_tools = {}
static_tools = static_tools.copy() if static_tools is not None else {}
custom_tools = custom_tools if custom_tools is not None else {}
result = None
global PRINT_OUTPUTS
PRINT_OUTPUTS = ""