diff --git a/src/smolagents/local_python_executor.py b/src/smolagents/local_python_executor.py index 0bfa53b7f..90aaae4e1 100644 --- a/src/smolagents/local_python_executor.py +++ b/src/smolagents/local_python_executor.py @@ -145,6 +145,16 @@ def nodunder_getattr(obj, name, default=None): "posix.system", ] +def local_python_executor_allow_all(): + """ This function allows all imports and functions to be executed locally. + BE CAREFUL - Only allow all in an isolated and crontolled environment. + USE IT AT YOUR OWN RISK.""" + global DANGEROUS_MODULES + global DANGEROUS_FUNCTIONS + global BASE_PYTHON_TOOLS + DANGEROUS_MODULES = [] + DANGEROUS_FUNCTIONS = [] + BASE_PYTHON_TOOLS["open"]=open class PrintContainer: def __init__(self):