camel-ai 0.2.73a10__py3-none-any.whl → 0.2.73a11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of camel-ai might be problematic. Click here for more details.
- camel/__init__.py +1 -1
- camel/toolkits/terminal_toolkit.py +13 -15
- {camel_ai-0.2.73a10.dist-info → camel_ai-0.2.73a11.dist-info}/METADATA +1 -1
- {camel_ai-0.2.73a10.dist-info → camel_ai-0.2.73a11.dist-info}/RECORD +6 -6
- {camel_ai-0.2.73a10.dist-info → camel_ai-0.2.73a11.dist-info}/WHEEL +0 -0
- {camel_ai-0.2.73a10.dist-info → camel_ai-0.2.73a11.dist-info}/licenses/LICENSE +0 -0
camel/__init__.py
CHANGED
|
@@ -62,6 +62,10 @@ class TerminalToolkit(BaseToolkit):
|
|
|
62
62
|
environment. (default: :obj:`False`)
|
|
63
63
|
safe_mode (bool): Whether to enable safe mode to restrict
|
|
64
64
|
operations. (default: :obj:`True`)
|
|
65
|
+
interactive (bool): Whether to use interactive mode for shell commands,
|
|
66
|
+
connecting them to the terminal's standard input. This is useful
|
|
67
|
+
for commands that require user input, like `ssh`. Interactive mode
|
|
68
|
+
is only supported on macOS and Linux. (default: :obj:`False`)
|
|
65
69
|
|
|
66
70
|
Note:
|
|
67
71
|
Most functions are compatible with Unix-based systems (macOS, Linux).
|
|
@@ -78,6 +82,7 @@ class TerminalToolkit(BaseToolkit):
|
|
|
78
82
|
use_shell_mode: bool = True,
|
|
79
83
|
clone_current_env: bool = False,
|
|
80
84
|
safe_mode: bool = True,
|
|
85
|
+
interactive: bool = False,
|
|
81
86
|
):
|
|
82
87
|
# Store timeout before calling super().__init__
|
|
83
88
|
self._timeout = timeout
|
|
@@ -93,6 +98,7 @@ class TerminalToolkit(BaseToolkit):
|
|
|
93
98
|
self.cloned_env_path = None
|
|
94
99
|
self.use_shell_mode = use_shell_mode
|
|
95
100
|
self._human_takeover_active = False
|
|
101
|
+
self.interactive = interactive
|
|
96
102
|
|
|
97
103
|
self.python_executable = sys.executable
|
|
98
104
|
self.is_macos = platform.system() == 'Darwin'
|
|
@@ -1002,26 +1008,18 @@ class TerminalToolkit(BaseToolkit):
|
|
|
1002
1008
|
|
|
1003
1009
|
return True, command
|
|
1004
1010
|
|
|
1005
|
-
def shell_exec(
|
|
1006
|
-
self, id: str, command: str, interactive: bool = False
|
|
1007
|
-
) -> str:
|
|
1011
|
+
def shell_exec(self, id: str, command: str) -> str:
|
|
1008
1012
|
r"""Executes a shell command in a specified session.
|
|
1009
1013
|
|
|
1010
1014
|
This function creates and manages shell sessions to execute commands,
|
|
1011
|
-
simulating a real terminal.
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
created.
|
|
1015
|
+
simulating a real terminal. The behavior depends on the toolkit's
|
|
1016
|
+
interactive mode setting. Each session is identified by a unique ID.
|
|
1017
|
+
If a session with the given ID does not exist, it will be created.
|
|
1015
1018
|
|
|
1016
1019
|
Args:
|
|
1017
1020
|
id (str): A unique identifier for the shell session. This is used
|
|
1018
1021
|
to manage multiple concurrent shell processes.
|
|
1019
1022
|
command (str): The shell command to be executed.
|
|
1020
|
-
interactive (bool, optional): If `True`, the command runs in
|
|
1021
|
-
interactive mode, connecting it to the terminal's standard
|
|
1022
|
-
input. This is useful for commands that require user input,
|
|
1023
|
-
like `ssh`. Defaults to `False`. Interactive mode is only
|
|
1024
|
-
supported on macOS and Linux. (default: :obj:`False`)
|
|
1025
1023
|
|
|
1026
1024
|
Returns:
|
|
1027
1025
|
str: The standard output and standard error from the command. If an
|
|
@@ -1029,8 +1027,8 @@ class TerminalToolkit(BaseToolkit):
|
|
|
1029
1027
|
returned.
|
|
1030
1028
|
|
|
1031
1029
|
Note:
|
|
1032
|
-
When
|
|
1033
|
-
|
|
1030
|
+
When the toolkit is initialized with interactive mode, commands may
|
|
1031
|
+
block if they require input. In safe mode, some commands that are
|
|
1034
1032
|
considered dangerous are restricted.
|
|
1035
1033
|
"""
|
|
1036
1034
|
error_msg = self._enforce_working_dir_for_execution(self.working_dir)
|
|
@@ -1127,7 +1125,7 @@ class TerminalToolkit(BaseToolkit):
|
|
|
1127
1125
|
elif pip_path and command.startswith('pip'):
|
|
1128
1126
|
command = command.replace('pip', pip_path, 1)
|
|
1129
1127
|
|
|
1130
|
-
if not interactive:
|
|
1128
|
+
if not self.interactive:
|
|
1131
1129
|
# Use preexec_fn to create a new process group on Unix systems
|
|
1132
1130
|
preexec_fn = None
|
|
1133
1131
|
if self.os_type in ['Darwin', 'Linux']:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
camel/__init__.py,sha256=
|
|
1
|
+
camel/__init__.py,sha256=Yl4Jgig3c5hYbRVL3vAj9lNQBcNAUouyTaFf7N6A8CQ,902
|
|
2
2
|
camel/generators.py,sha256=JRqj9_m1PF4qT6UtybzTQ-KBT9MJQt18OAAYvQ_fr2o,13844
|
|
3
3
|
camel/human.py,sha256=Xg8x1cS5KK4bQ1SDByiHZnzsRpvRP-KZViNvmu38xo4,5475
|
|
4
4
|
camel/logger.py,sha256=WgEwael_eT6D-lVAKHpKIpwXSTjvLbny5jbV1Ab8lnA,5760
|
|
@@ -378,7 +378,7 @@ camel/toolkits/slack_toolkit.py,sha256=iBVkDIpfsR5QwaNCqA4O4UkCwpdLhJjYCA8Gka7U9
|
|
|
378
378
|
camel/toolkits/stripe_toolkit.py,sha256=07swo5znGTnorafC1uYLKB4NRcJIOPOx19J7tkpLYWk,10102
|
|
379
379
|
camel/toolkits/sympy_toolkit.py,sha256=BAQnI8EFJydNUpKQWXBdleQ1Cm-srDBhFlqp9V9pbPQ,33757
|
|
380
380
|
camel/toolkits/task_planning_toolkit.py,sha256=Ttw9fHae4omGC1SA-6uaeXVHJ1YkwiVloz_hO-fm1gw,4855
|
|
381
|
-
camel/toolkits/terminal_toolkit.py,sha256=
|
|
381
|
+
camel/toolkits/terminal_toolkit.py,sha256=gHsBZl1GRiP9dzqvksk1Kf7QahhRJZBQlvZZ27oLTWE,68149
|
|
382
382
|
camel/toolkits/thinking_toolkit.py,sha256=nZYLvKWIx2BM1DYu69I9B5EISAG7aYcLYXKv9663BVk,8000
|
|
383
383
|
camel/toolkits/twitter_toolkit.py,sha256=Px4N8aUxUzy01LhGSWkdrC2JgwKkrY3cvxgMeJ2XYfU,15939
|
|
384
384
|
camel/toolkits/video_analysis_toolkit.py,sha256=h6D7b1MAAzaHn222n_YKtwG-EGEGgMt7mBrNNVipYZc,23361
|
|
@@ -467,7 +467,7 @@ camel/verifiers/math_verifier.py,sha256=tA1D4S0sm8nsWISevxSN0hvSVtIUpqmJhzqfbuMo
|
|
|
467
467
|
camel/verifiers/models.py,sha256=GdxYPr7UxNrR1577yW4kyroRcLGfd-H1GXgv8potDWU,2471
|
|
468
468
|
camel/verifiers/physics_verifier.py,sha256=c1grrRddcrVN7szkxhv2QirwY9viIRSITWeWFF5HmLs,30187
|
|
469
469
|
camel/verifiers/python_verifier.py,sha256=ogTz77wODfEcDN4tMVtiSkRQyoiZbHPY2fKybn59lHw,20558
|
|
470
|
-
camel_ai-0.2.
|
|
471
|
-
camel_ai-0.2.
|
|
472
|
-
camel_ai-0.2.
|
|
473
|
-
camel_ai-0.2.
|
|
470
|
+
camel_ai-0.2.73a11.dist-info/METADATA,sha256=Ol7UuDaS31XjG8zPGZQzuZRYBO5tkUwN9z6s6VZD0gI,50435
|
|
471
|
+
camel_ai-0.2.73a11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
472
|
+
camel_ai-0.2.73a11.dist-info/licenses/LICENSE,sha256=id0nB2my5kG0xXeimIu5zZrbHLS6EQvxvkKkzIHaT2k,11343
|
|
473
|
+
camel_ai-0.2.73a11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|