Skip to content

Commit fe2a2b6

Browse files
Small change in run_os_command
1 parent a7b0ba8 commit fe2a2b6

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/smolagents/bp_tools.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def force_directories(file_path: str) -> None:
252252
os.makedirs(directory_path, exist_ok=True)
253253

254254
@tool
255-
def run_os_command(str_command: str, timeout: int = 60, max_memory:int = 274877906944) -> str:
255+
def run_os_command(str_command: str, timeout: int = 600, max_memory:int = 274877906944) -> str:
256256
"""
257257
This function runs an OS command and returns the output as a string.
258258
This implementation uses Popen with shell=True.
@@ -268,17 +268,16 @@ def run_os_command(str_command: str, timeout: int = 60, max_memory:int = 2748779
268268
<example>
269269
<savetofile filename="hello.php"><?php echo "hello"; ?></savetofile>
270270
<runcode>
271-
# 60 seconds of timeout and 512MB of max memory
272-
print(run_os_command("php hello.php", timeout=60, max_memory=512*1024*1024))
271+
print(run_os_command("php hello.php"))
273272
</runcode>
274273
</example>
275274
276275
As you can see in the above command, you can use any computer language that is available in the system. If it is not, you can install it using the run_os_command tool.
277276
278277
Args:
279278
str_command: str
280-
timeout: int seconds
281-
max_memory: int bytes
279+
timeout: int seconds (optional)
280+
max_memory: int bytes (optional)
282281
"""
283282
command = str_command
284283
if max_memory > 0 and _HAS_PRLIMIT:

0 commit comments

Comments
 (0)