camel-ai 0.2.71a11__py3-none-any.whl → 0.2.72__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/agents/chat_agent.py +261 -489
- camel/memories/agent_memories.py +39 -0
- camel/memories/base.py +8 -0
- camel/models/gemini_model.py +30 -2
- camel/models/moonshot_model.py +36 -4
- camel/models/openai_model.py +29 -15
- camel/societies/workforce/prompts.py +25 -15
- camel/societies/workforce/role_playing_worker.py +1 -1
- camel/societies/workforce/single_agent_worker.py +9 -7
- camel/societies/workforce/worker.py +1 -1
- camel/societies/workforce/workforce.py +97 -34
- camel/storages/vectordb_storages/__init__.py +1 -0
- camel/storages/vectordb_storages/surreal.py +415 -0
- camel/tasks/task.py +9 -5
- camel/toolkits/__init__.py +10 -1
- camel/toolkits/base.py +57 -1
- camel/toolkits/human_toolkit.py +5 -1
- camel/toolkits/hybrid_browser_toolkit/config_loader.py +127 -414
- camel/toolkits/hybrid_browser_toolkit/hybrid_browser_toolkit.py +783 -1626
- camel/toolkits/hybrid_browser_toolkit/ws_wrapper.py +489 -0
- camel/toolkits/markitdown_toolkit.py +2 -2
- camel/toolkits/message_integration.py +592 -0
- camel/toolkits/note_taking_toolkit.py +195 -26
- camel/toolkits/openai_image_toolkit.py +5 -5
- camel/toolkits/origene_mcp_toolkit.py +97 -0
- camel/toolkits/screenshot_toolkit.py +213 -0
- camel/toolkits/search_toolkit.py +161 -79
- camel/toolkits/terminal_toolkit.py +379 -165
- camel/toolkits/video_analysis_toolkit.py +13 -13
- camel/toolkits/video_download_toolkit.py +11 -11
- camel/toolkits/web_deploy_toolkit.py +1024 -0
- camel/types/enums.py +6 -3
- camel/types/unified_model_type.py +16 -4
- camel/utils/mcp_client.py +8 -0
- camel/utils/tool_result.py +1 -1
- {camel_ai-0.2.71a11.dist-info → camel_ai-0.2.72.dist-info}/METADATA +6 -3
- {camel_ai-0.2.71a11.dist-info → camel_ai-0.2.72.dist-info}/RECORD +40 -40
- camel/toolkits/hybrid_browser_toolkit/actions.py +0 -417
- camel/toolkits/hybrid_browser_toolkit/agent.py +0 -311
- camel/toolkits/hybrid_browser_toolkit/browser_session.py +0 -739
- camel/toolkits/hybrid_browser_toolkit/snapshot.py +0 -227
- camel/toolkits/hybrid_browser_toolkit/stealth_script.js +0 -0
- camel/toolkits/hybrid_browser_toolkit/unified_analyzer.js +0 -1002
- {camel_ai-0.2.71a11.dist-info → camel_ai-0.2.72.dist-info}/WHEEL +0 -0
- {camel_ai-0.2.71a11.dist-info → camel_ai-0.2.72.dist-info}/licenses/LICENSE +0 -0
|
@@ -97,7 +97,7 @@ class VideoAnalysisToolkit(BaseToolkit):
|
|
|
97
97
|
r"""A class for analysing videos with vision-language model.
|
|
98
98
|
|
|
99
99
|
Args:
|
|
100
|
-
|
|
100
|
+
working_directory (Optional[str], optional): The directory where the
|
|
101
101
|
video will be downloaded to. If not provided, video will be stored
|
|
102
102
|
in a temporary directory and will be cleaned up after use.
|
|
103
103
|
(default: :obj:`None`)
|
|
@@ -123,7 +123,7 @@ class VideoAnalysisToolkit(BaseToolkit):
|
|
|
123
123
|
@dependencies_required("ffmpeg", "scenedetect")
|
|
124
124
|
def __init__(
|
|
125
125
|
self,
|
|
126
|
-
|
|
126
|
+
working_directory: Optional[str] = None,
|
|
127
127
|
model: Optional[BaseModelBackend] = None,
|
|
128
128
|
use_audio_transcription: bool = False,
|
|
129
129
|
use_ocr: bool = False,
|
|
@@ -133,30 +133,30 @@ class VideoAnalysisToolkit(BaseToolkit):
|
|
|
133
133
|
timeout: Optional[float] = None,
|
|
134
134
|
) -> None:
|
|
135
135
|
super().__init__(timeout=timeout)
|
|
136
|
-
self._cleanup =
|
|
136
|
+
self._cleanup = working_directory is None
|
|
137
137
|
self._temp_files: list[str] = [] # Track temporary files for cleanup
|
|
138
138
|
self._use_audio_transcription = use_audio_transcription
|
|
139
139
|
self._use_ocr = use_ocr
|
|
140
140
|
self.output_language = output_language
|
|
141
141
|
self.frame_interval = frame_interval
|
|
142
142
|
|
|
143
|
-
self.
|
|
144
|
-
|
|
143
|
+
self._working_directory = Path(
|
|
144
|
+
working_directory or tempfile.mkdtemp()
|
|
145
145
|
).resolve()
|
|
146
146
|
|
|
147
147
|
self.video_downloader_toolkit = VideoDownloaderToolkit(
|
|
148
|
-
|
|
148
|
+
working_directory=str(self._working_directory),
|
|
149
149
|
cookies_path=cookies_path,
|
|
150
150
|
)
|
|
151
151
|
|
|
152
152
|
try:
|
|
153
|
-
self.
|
|
153
|
+
self._working_directory.mkdir(parents=True, exist_ok=True)
|
|
154
154
|
except OSError as e:
|
|
155
155
|
raise ValueError(
|
|
156
|
-
f"Error creating directory {self.
|
|
156
|
+
f"Error creating directory {self._working_directory}: {e}"
|
|
157
157
|
)
|
|
158
158
|
|
|
159
|
-
logger.info(f"Video will be downloaded to {self.
|
|
159
|
+
logger.info(f"Video will be downloaded to {self._working_directory}")
|
|
160
160
|
|
|
161
161
|
self.vl_model = model
|
|
162
162
|
# Ensure ChatAgent is initialized with a model if provided
|
|
@@ -206,16 +206,16 @@ class VideoAnalysisToolkit(BaseToolkit):
|
|
|
206
206
|
)
|
|
207
207
|
|
|
208
208
|
# Clean up temporary directory if needed
|
|
209
|
-
if self._cleanup and os.path.exists(self.
|
|
209
|
+
if self._cleanup and os.path.exists(self._working_directory):
|
|
210
210
|
try:
|
|
211
211
|
import sys
|
|
212
212
|
|
|
213
213
|
if getattr(sys, 'modules', None) is not None:
|
|
214
214
|
import shutil
|
|
215
215
|
|
|
216
|
-
shutil.rmtree(self.
|
|
216
|
+
shutil.rmtree(self._working_directory)
|
|
217
217
|
logger.debug(
|
|
218
|
-
f"Removed temp directory: {self.
|
|
218
|
+
f"Removed temp directory: {self._working_directory}"
|
|
219
219
|
)
|
|
220
220
|
except (ImportError, AttributeError):
|
|
221
221
|
# Skip cleanup if interpreter is shutting down
|
|
@@ -223,7 +223,7 @@ class VideoAnalysisToolkit(BaseToolkit):
|
|
|
223
223
|
except OSError as e:
|
|
224
224
|
logger.warning(
|
|
225
225
|
f"Failed to remove temporary directory "
|
|
226
|
-
f"{self.
|
|
226
|
+
f"{self._working_directory}: {e}"
|
|
227
227
|
)
|
|
228
228
|
|
|
229
229
|
@dependencies_required("pytesseract", "cv2", "numpy")
|
|
@@ -62,7 +62,7 @@ class VideoDownloaderToolkit(BaseToolkit):
|
|
|
62
62
|
chunks.
|
|
63
63
|
|
|
64
64
|
Args:
|
|
65
|
-
|
|
65
|
+
working_directory (Optional[str], optional): The directory where the
|
|
66
66
|
video will be downloaded to. If not provided, video will be stored
|
|
67
67
|
in a temporary directory and will be cleaned up after use.
|
|
68
68
|
(default: :obj:`None`)
|
|
@@ -73,30 +73,30 @@ class VideoDownloaderToolkit(BaseToolkit):
|
|
|
73
73
|
@dependencies_required("yt_dlp", "ffmpeg")
|
|
74
74
|
def __init__(
|
|
75
75
|
self,
|
|
76
|
-
|
|
76
|
+
working_directory: Optional[str] = None,
|
|
77
77
|
cookies_path: Optional[str] = None,
|
|
78
78
|
timeout: Optional[float] = None,
|
|
79
79
|
) -> None:
|
|
80
80
|
super().__init__(timeout=timeout)
|
|
81
|
-
self._cleanup =
|
|
81
|
+
self._cleanup = working_directory is None
|
|
82
82
|
self._cookies_path = cookies_path
|
|
83
83
|
|
|
84
|
-
self.
|
|
85
|
-
|
|
84
|
+
self._working_directory = Path(
|
|
85
|
+
working_directory or tempfile.mkdtemp()
|
|
86
86
|
).resolve()
|
|
87
87
|
|
|
88
88
|
try:
|
|
89
|
-
self.
|
|
89
|
+
self._working_directory.mkdir(parents=True, exist_ok=True)
|
|
90
90
|
except FileExistsError:
|
|
91
91
|
raise ValueError(
|
|
92
|
-
f"{self.
|
|
92
|
+
f"{self._working_directory} is not a valid directory."
|
|
93
93
|
)
|
|
94
94
|
except OSError as e:
|
|
95
95
|
raise ValueError(
|
|
96
|
-
f"Error creating directory {self.
|
|
96
|
+
f"Error creating directory {self._working_directory}: {e}"
|
|
97
97
|
)
|
|
98
98
|
|
|
99
|
-
logger.info(f"Video will be downloaded to {self.
|
|
99
|
+
logger.info(f"Video will be downloaded to {self._working_directory}")
|
|
100
100
|
|
|
101
101
|
def __del__(self) -> None:
|
|
102
102
|
r"""Deconstructor for the VideoDownloaderToolkit class.
|
|
@@ -111,7 +111,7 @@ class VideoDownloaderToolkit(BaseToolkit):
|
|
|
111
111
|
if getattr(sys, 'modules', None) is not None:
|
|
112
112
|
import shutil
|
|
113
113
|
|
|
114
|
-
shutil.rmtree(self.
|
|
114
|
+
shutil.rmtree(self._working_directory, ignore_errors=True)
|
|
115
115
|
except (ImportError, AttributeError):
|
|
116
116
|
# Skip cleanup if interpreter is shutting down
|
|
117
117
|
pass
|
|
@@ -130,7 +130,7 @@ class VideoDownloaderToolkit(BaseToolkit):
|
|
|
130
130
|
"""
|
|
131
131
|
import yt_dlp
|
|
132
132
|
|
|
133
|
-
video_template = self.
|
|
133
|
+
video_template = self._working_directory / "%(title)s.%(ext)s"
|
|
134
134
|
ydl_opts = {
|
|
135
135
|
'format': 'bestvideo+bestaudio/best',
|
|
136
136
|
'outtmpl': str(video_template),
|