camel-ai 0.2.71a6__py3-none-any.whl → 0.2.71a8__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/societies/workforce/single_agent_worker.py +2 -0
- camel/societies/workforce/task_channel.py +4 -1
- camel/societies/workforce/worker.py +2 -0
- camel/societies/workforce/workforce.py +20 -20
- camel/toolkits/file_write_toolkit.py +198 -132
- camel/toolkits/hybrid_browser_toolkit/actions.py +28 -18
- camel/toolkits/hybrid_browser_toolkit/agent.py +7 -1
- camel/toolkits/hybrid_browser_toolkit/browser_session.py +48 -18
- camel/toolkits/hybrid_browser_toolkit/config_loader.py +447 -0
- camel/toolkits/hybrid_browser_toolkit/hybrid_browser_toolkit.py +272 -85
- camel/toolkits/hybrid_browser_toolkit/snapshot.py +5 -4
- camel/toolkits/hybrid_browser_toolkit/unified_analyzer.js +572 -17
- camel/toolkits/note_taking_toolkit.py +24 -9
- camel/toolkits/pptx_toolkit.py +21 -8
- camel/toolkits/search_toolkit.py +15 -5
- {camel_ai-0.2.71a6.dist-info → camel_ai-0.2.71a8.dist-info}/METADATA +1 -1
- {camel_ai-0.2.71a6.dist-info → camel_ai-0.2.71a8.dist-info}/RECORD +20 -20
- camel/toolkits/hybrid_browser_toolkit/stealth_config.py +0 -116
- {camel_ai-0.2.71a6.dist-info → camel_ai-0.2.71a8.dist-info}/WHEEL +0 -0
- {camel_ai-0.2.71a6.dist-info → camel_ai-0.2.71a8.dist-info}/licenses/LICENSE +0 -0
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
13
|
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
|
+
import os
|
|
14
15
|
from pathlib import Path
|
|
15
16
|
from typing import List, Optional
|
|
16
17
|
|
|
@@ -27,19 +28,31 @@ class NoteTakingToolkit(BaseToolkit):
|
|
|
27
28
|
|
|
28
29
|
def __init__(
|
|
29
30
|
self,
|
|
30
|
-
|
|
31
|
+
working_directory: Optional[str] = None,
|
|
31
32
|
timeout: Optional[float] = None,
|
|
32
33
|
) -> None:
|
|
33
34
|
r"""Initialize the NoteTakingToolkit.
|
|
34
35
|
|
|
35
36
|
Args:
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
working_directory (str, optional): The path to the note file.
|
|
38
|
+
If not provided, it will be determined by the
|
|
39
|
+
`CAMEL_WORKDIR` environment variable (if set), saving
|
|
40
|
+
the note as `notes.md` in that directory. If the
|
|
41
|
+
environment variable is not set, it defaults to
|
|
42
|
+
`camel_working_dir/notes.md`.
|
|
38
43
|
timeout (Optional[float]): The timeout for the toolkit.
|
|
39
44
|
"""
|
|
40
45
|
super().__init__(timeout=timeout)
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
camel_workdir = os.environ.get("CAMEL_WORKDIR")
|
|
47
|
+
if working_directory:
|
|
48
|
+
path = Path(working_directory)
|
|
49
|
+
elif camel_workdir:
|
|
50
|
+
path = Path(camel_workdir) / "notes.md"
|
|
51
|
+
else:
|
|
52
|
+
path = Path("camel_working_dir") / "notes.md"
|
|
53
|
+
|
|
54
|
+
self.working_directory = path
|
|
55
|
+
self.working_directory.parent.mkdir(parents=True, exist_ok=True)
|
|
43
56
|
|
|
44
57
|
def append_note(self, content: str) -> str:
|
|
45
58
|
r"""Appends a note to the note file.
|
|
@@ -51,9 +64,11 @@ class NoteTakingToolkit(BaseToolkit):
|
|
|
51
64
|
str: A message indicating the result of the operation.
|
|
52
65
|
"""
|
|
53
66
|
try:
|
|
54
|
-
with self.
|
|
67
|
+
with self.working_directory.open("a", encoding="utf-8") as f:
|
|
55
68
|
f.write(content + "\n")
|
|
56
|
-
return
|
|
69
|
+
return (
|
|
70
|
+
f"Note successfully appended to in {self.working_directory}."
|
|
71
|
+
)
|
|
57
72
|
except Exception as e:
|
|
58
73
|
return f"Error appending note: {e}"
|
|
59
74
|
|
|
@@ -65,9 +80,9 @@ class NoteTakingToolkit(BaseToolkit):
|
|
|
65
80
|
file cannot be read.
|
|
66
81
|
"""
|
|
67
82
|
try:
|
|
68
|
-
if not self.
|
|
83
|
+
if not self.working_directory.exists():
|
|
69
84
|
return "Note file does not exist yet."
|
|
70
|
-
return self.
|
|
85
|
+
return self.working_directory.read_text(encoding="utf-8")
|
|
71
86
|
except Exception as e:
|
|
72
87
|
return f"Error reading note: {e}"
|
|
73
88
|
|
camel/toolkits/pptx_toolkit.py
CHANGED
|
@@ -53,22 +53,35 @@ class PPTXToolkit(BaseToolkit):
|
|
|
53
53
|
|
|
54
54
|
def __init__(
|
|
55
55
|
self,
|
|
56
|
-
|
|
56
|
+
working_directory: Optional[str] = None,
|
|
57
57
|
timeout: Optional[float] = None,
|
|
58
58
|
) -> None:
|
|
59
59
|
r"""Initialize the PPTXToolkit.
|
|
60
60
|
|
|
61
61
|
Args:
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
working_directory (str, optional): The default directory for
|
|
63
|
+
output files. If not provided, it will be determined by the
|
|
64
|
+
`CAMEL_WORKDIR` environment variable (if set). If the
|
|
65
|
+
environment variable is not set, it defaults to
|
|
66
|
+
`camel_working_dir`.
|
|
64
67
|
timeout (Optional[float]): The timeout for the toolkit.
|
|
65
68
|
(default: :obj:`None`)
|
|
66
69
|
"""
|
|
67
70
|
super().__init__(timeout=timeout)
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
|
|
72
|
+
if working_directory:
|
|
73
|
+
self.working_directory = Path(working_directory).resolve()
|
|
74
|
+
else:
|
|
75
|
+
camel_workdir = os.environ.get("CAMEL_WORKDIR")
|
|
76
|
+
if camel_workdir:
|
|
77
|
+
self.working_directory = Path(camel_workdir).resolve()
|
|
78
|
+
else:
|
|
79
|
+
self.working_directory = Path("./camel_working_dir").resolve()
|
|
80
|
+
|
|
81
|
+
self.working_directory.mkdir(parents=True, exist_ok=True)
|
|
70
82
|
logger.info(
|
|
71
|
-
f"PPTXToolkit initialized with output directory:
|
|
83
|
+
f"PPTXToolkit initialized with output directory: "
|
|
84
|
+
f"{self.working_directory}"
|
|
72
85
|
)
|
|
73
86
|
|
|
74
87
|
def _resolve_filepath(self, file_path: str) -> Path:
|
|
@@ -87,7 +100,7 @@ class PPTXToolkit(BaseToolkit):
|
|
|
87
100
|
"""
|
|
88
101
|
path_obj = Path(file_path)
|
|
89
102
|
if not path_obj.is_absolute():
|
|
90
|
-
path_obj = self.
|
|
103
|
+
path_obj = self.working_directory / path_obj
|
|
91
104
|
|
|
92
105
|
sanitized_filename = self._sanitize_filename(path_obj.name)
|
|
93
106
|
path_obj = path_obj.parent / sanitized_filename
|
|
@@ -365,7 +378,7 @@ class PPTXToolkit(BaseToolkit):
|
|
|
365
378
|
* Table slides: {"heading": str, "table": {"headers": list
|
|
366
379
|
of str, "rows": list of list of str}}
|
|
367
380
|
filename (str): The name or path of the file. If a relative path is
|
|
368
|
-
supplied, it is resolved to self.
|
|
381
|
+
supplied, it is resolved to self.working_directory.
|
|
369
382
|
template (Optional[str]): The path to the template PPTX file.
|
|
370
383
|
Initializes a presentation from a given template file Or PPTX
|
|
371
384
|
file. (default: :obj:`None`)
|
camel/toolkits/search_toolkit.py
CHANGED
|
@@ -16,10 +16,13 @@ from typing import Any, Dict, List, Literal, Optional, TypeAlias, Union, cast
|
|
|
16
16
|
|
|
17
17
|
import requests
|
|
18
18
|
|
|
19
|
+
from camel.logger import get_logger
|
|
19
20
|
from camel.toolkits.base import BaseToolkit
|
|
20
21
|
from camel.toolkits.function_tool import FunctionTool
|
|
21
22
|
from camel.utils import MCPServer, api_keys_required, dependencies_required
|
|
22
23
|
|
|
24
|
+
logger = get_logger(__name__)
|
|
25
|
+
|
|
23
26
|
|
|
24
27
|
@MCPServer()
|
|
25
28
|
class SearchToolkit(BaseToolkit):
|
|
@@ -480,12 +483,19 @@ class SearchToolkit(BaseToolkit):
|
|
|
480
483
|
}
|
|
481
484
|
responses.append(response)
|
|
482
485
|
else:
|
|
483
|
-
|
|
486
|
+
error_info = data.get("error", {})
|
|
487
|
+
logger.error(
|
|
488
|
+
f"Google search failed - API response: {error_info}"
|
|
489
|
+
)
|
|
490
|
+
responses.append(
|
|
491
|
+
{
|
|
492
|
+
"error": f"Google search failed - "
|
|
493
|
+
f"API response: {error_info}"
|
|
494
|
+
}
|
|
495
|
+
)
|
|
484
496
|
|
|
485
|
-
except
|
|
486
|
-
|
|
487
|
-
responses.append({"error": "google search failed."})
|
|
488
|
-
# If no answer found, return an empty list
|
|
497
|
+
except Exception as e:
|
|
498
|
+
responses.append({"error": f"google search failed: {e!s}"})
|
|
489
499
|
return responses
|
|
490
500
|
|
|
491
501
|
def tavily_search(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
camel/__init__.py,sha256=
|
|
1
|
+
camel/__init__.py,sha256=TUs23EA2p98OC0WV8dpKGkATsBnuXjPHnsVhnXlDUPk,901
|
|
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
|
|
@@ -275,12 +275,12 @@ camel/societies/workforce/__init__.py,sha256=bkTI-PE-MSK9AQ2V2gR6cR2WY-R7Jqy_NmX
|
|
|
275
275
|
camel/societies/workforce/base.py,sha256=z2DmbTP5LL5-aCAAqglznQqCLfPmnyM5zD3w6jjtsb8,2175
|
|
276
276
|
camel/societies/workforce/prompts.py,sha256=gobVelz7rRdReogFG2QCfFy21GfhaQJyoiNnKWo4EHE,14391
|
|
277
277
|
camel/societies/workforce/role_playing_worker.py,sha256=z5-OcNiaNEaoC206_3HD7xeonuUkD-XTxYbD3AqoNC8,10319
|
|
278
|
-
camel/societies/workforce/single_agent_worker.py,sha256=
|
|
278
|
+
camel/societies/workforce/single_agent_worker.py,sha256=seWeFR-scpaTSS0yXwqJSJkUWaNuiYyuxDTfbpebRN8,17314
|
|
279
279
|
camel/societies/workforce/structured_output_handler.py,sha256=xr8szFN86hg3jQ825aEkJTjkSFQnTlbinVg4j1vZJVI,17870
|
|
280
|
-
camel/societies/workforce/task_channel.py,sha256=
|
|
280
|
+
camel/societies/workforce/task_channel.py,sha256=GWHaGQBpjTzdKbWoBYAQzzAiLKRKRXa6beqtc4cg-Is,7611
|
|
281
281
|
camel/societies/workforce/utils.py,sha256=THgNHSeZsNVnjTzQTur3qCJhi72MrDS8X2gPET174cI,8434
|
|
282
|
-
camel/societies/workforce/worker.py,sha256=
|
|
283
|
-
camel/societies/workforce/workforce.py,sha256=
|
|
282
|
+
camel/societies/workforce/worker.py,sha256=k_AokiF-HAfq6Cd5SQYb0uaoJsA_kSwV_n5o1fxvzmo,6522
|
|
283
|
+
camel/societies/workforce/workforce.py,sha256=u-AVADZFYWLQMB6WjB8gsDcVE3z48LYpGDwdkhlIut0,133692
|
|
284
284
|
camel/societies/workforce/workforce_logger.py,sha256=0YT__ys48Bgn0IICKIZBmSWhON-eA1KShebjCdn5ppE,24525
|
|
285
285
|
camel/storages/__init__.py,sha256=RwpEyvxpMbJzVDZJJygeBg4AzyYMkTjjkfB53hTuqGo,2141
|
|
286
286
|
camel/storages/graph_storages/__init__.py,sha256=G29BNn651C0WTOpjCl4QnVM-4B9tcNh8DdmsCiONH8Y,948
|
|
@@ -332,7 +332,7 @@ camel/toolkits/dappier_toolkit.py,sha256=OEHOYXX_oXhgbVtWYAy13nO9uXf9i5qEXSwY4Pe
|
|
|
332
332
|
camel/toolkits/data_commons_toolkit.py,sha256=aHZUSL1ACpnYGaf1rE2csVKTmXTmN8lMGRUBYhZ_YEk,14168
|
|
333
333
|
camel/toolkits/edgeone_pages_mcp_toolkit.py,sha256=1TFpAGHUNLggFQeN1OEw7P5laijwnlrCkfxBtgxFuUY,2331
|
|
334
334
|
camel/toolkits/excel_toolkit.py,sha256=9Uk5GLWl719c4W-NcGPJTNMtodAbEE5gUgLsFkIInbk,32564
|
|
335
|
-
camel/toolkits/file_write_toolkit.py,sha256=
|
|
335
|
+
camel/toolkits/file_write_toolkit.py,sha256=d8N8FfmK1fS13sY58PPhJh6M0vq6yh-s1-ltCZQJObg,37044
|
|
336
336
|
camel/toolkits/function_tool.py,sha256=xCDzjxTRCVj_kmbnMFBuwK-3NuzM4JNe_kv9HLtjnIA,33644
|
|
337
337
|
camel/toolkits/github_toolkit.py,sha256=iUyRrjWGAW_iljZVfNyfkm1Vi55wJxK6PsDAQs9pOag,13099
|
|
338
338
|
camel/toolkits/google_calendar_toolkit.py,sha256=E-sdgdbtNBs_CXbhht9t1dsVr4DsTr5NguHkx4fvSmc,15410
|
|
@@ -352,7 +352,7 @@ camel/toolkits/meshy_toolkit.py,sha256=NbgdOBD3FYLtZf-AfonIv6-Q8-8DW129jsaP1PqI2
|
|
|
352
352
|
camel/toolkits/message_agent_toolkit.py,sha256=yWvAaxoxAvDEtD7NH7IkkHIyfWIYK47WZhn5E_RaxKo,22661
|
|
353
353
|
camel/toolkits/mineru_toolkit.py,sha256=vRX9LholLNkpbJ6axfEN4pTG85aWb0PDmlVy3rAAXhg,6868
|
|
354
354
|
camel/toolkits/networkx_toolkit.py,sha256=C7pUCZTzzGkFyqdkrmhRKpAHmHWfLKeuzYHC_BHPtbk,8826
|
|
355
|
-
camel/toolkits/note_taking_toolkit.py,sha256=
|
|
355
|
+
camel/toolkits/note_taking_toolkit.py,sha256=AOE-nfp1TsfKiNcnQZyJYHyFb5gwpm0HYByoC7-wJyQ,3628
|
|
356
356
|
camel/toolkits/notion_toolkit.py,sha256=jmmVWk_WazRNWnx4r9DAvhFTAL-n_ige0tb32UHJ_ik,9752
|
|
357
357
|
camel/toolkits/open_api_toolkit.py,sha256=Venfq8JwTMQfzRzzB7AYmYUMEX35hW0BjIv_ozFMiNk,23316
|
|
358
358
|
camel/toolkits/openai_agent_toolkit.py,sha256=hT2ancdQigngAiY1LNnGJzZeiBDHUxrRGv6BdZTJizc,4696
|
|
@@ -360,13 +360,13 @@ camel/toolkits/openai_image_toolkit.py,sha256=-7_3utTx3T2GgDSW5Sdz4yBDzUcBMimC2Q
|
|
|
360
360
|
camel/toolkits/openbb_toolkit.py,sha256=8yBZL9E2iSgskosBQhD3pTP56oV6gerWpFjIJc_2UMo,28935
|
|
361
361
|
camel/toolkits/page_script.js,sha256=mXepZPnQNVLp_Wgb64lv7DMQIJYl_XIHJHLVt1OFZO4,13146
|
|
362
362
|
camel/toolkits/playwright_mcp_toolkit.py,sha256=TRweKatFu-7UzfiuXrud2D_4OQjbf4tdP_sCBJ69FG8,3018
|
|
363
|
-
camel/toolkits/pptx_toolkit.py,sha256=
|
|
363
|
+
camel/toolkits/pptx_toolkit.py,sha256=kE2sofzAm0Hmawj7oOu0Z7D-RdJRBAIG-Bdfxoag3zU,29136
|
|
364
364
|
camel/toolkits/pubmed_toolkit.py,sha256=VGl8KeyWi7pjb2kEhFBLmpBlP9ezv8JyWRHtEVTQ6nQ,12227
|
|
365
365
|
camel/toolkits/pulse_mcp_search_toolkit.py,sha256=uLUpm19uC_4xLJow0gGVS9f-5T5EW2iRAXdJ4nqJG-A,4783
|
|
366
366
|
camel/toolkits/pyautogui_toolkit.py,sha256=Q810fm8cFvElRory7B74aqS2YV6BOpdRE6jkewoM8xc,16093
|
|
367
367
|
camel/toolkits/reddit_toolkit.py,sha256=x0XAT1zQJVNHUr1R1HwWCgIlkamU-kPmbfb_H1WIv-w,8036
|
|
368
368
|
camel/toolkits/retrieval_toolkit.py,sha256=BKjEyOqW3cGEPTS5yHPYb-Qg795iNNPIs1wjowfuq3U,3825
|
|
369
|
-
camel/toolkits/search_toolkit.py,sha256=
|
|
369
|
+
camel/toolkits/search_toolkit.py,sha256=hqiqF8QJVaghQv36ra36SFzpjZkw7aJWsnMfGYaH_CQ,43996
|
|
370
370
|
camel/toolkits/searxng_toolkit.py,sha256=a2GtE4FGSrmaIVvX6Yide-abBYD1wsHqitnDlx9fdVg,7664
|
|
371
371
|
camel/toolkits/semantic_scholar_toolkit.py,sha256=Rh7eA_YPxV5pvPIzhjjvpr3vtlaCniJicrqzkPWW9_I,11634
|
|
372
372
|
camel/toolkits/slack_toolkit.py,sha256=4Bj8P2ardLwfiyUz3ha5QobSvziV54E9zipysCg9GuI,11208
|
|
@@ -383,14 +383,14 @@ camel/toolkits/whatsapp_toolkit.py,sha256=udUQXkXyeWsmrUlOJZsGBhHtc_jhB05Axe_Tch
|
|
|
383
383
|
camel/toolkits/wolfram_alpha_toolkit.py,sha256=qeIM8ySn5ilcExBWtx-hDOc35bNcebLVnZ67kt1H3mQ,9295
|
|
384
384
|
camel/toolkits/zapier_toolkit.py,sha256=A83y1UcfuopH7Fx82pORzypl1StbhBjB2HhyOqYa300,7124
|
|
385
385
|
camel/toolkits/hybrid_browser_toolkit/__init__.py,sha256=vxjWhq7GjUKE5I9RGQU_GoikZJ-AVK4ertdvEqp9pd0,802
|
|
386
|
-
camel/toolkits/hybrid_browser_toolkit/actions.py,sha256=
|
|
387
|
-
camel/toolkits/hybrid_browser_toolkit/agent.py,sha256=
|
|
388
|
-
camel/toolkits/hybrid_browser_toolkit/browser_session.py,sha256
|
|
389
|
-
camel/toolkits/hybrid_browser_toolkit/
|
|
390
|
-
camel/toolkits/hybrid_browser_toolkit/
|
|
391
|
-
camel/toolkits/hybrid_browser_toolkit/
|
|
386
|
+
camel/toolkits/hybrid_browser_toolkit/actions.py,sha256=x6X-kEdQx3K1ID-BBwdQEciX6C0KMt5QUszpnksnj3A,15003
|
|
387
|
+
camel/toolkits/hybrid_browser_toolkit/agent.py,sha256=0ifwhYUDJ5GLxfdpC5KquPaW1a0QBAutp2Y9y0YFujw,11685
|
|
388
|
+
camel/toolkits/hybrid_browser_toolkit/browser_session.py,sha256=LdXjF4eBFuqoRnbPU0ErBtR5wtbcv3cv-hBXtiDkgMg,27102
|
|
389
|
+
camel/toolkits/hybrid_browser_toolkit/config_loader.py,sha256=0zpDq3aFKEva2jc38kgLHnyxypIDk9SOcMjoP26tozo,15414
|
|
390
|
+
camel/toolkits/hybrid_browser_toolkit/hybrid_browser_toolkit.py,sha256=Mfr0-1FFCfY9cgzQ5JHD4vimh0Nbu203nwmad3RDwiU,80391
|
|
391
|
+
camel/toolkits/hybrid_browser_toolkit/snapshot.py,sha256=3vQaFK5C1P8WnkK2eDMaFOizrZf4uUAW0LxdeoF4F2w,8539
|
|
392
392
|
camel/toolkits/hybrid_browser_toolkit/stealth_script.js,sha256=z4XRSVUpAS87Sj36s3bY8XXhvRcHBlgsUOyMxV2HI80,27650
|
|
393
|
-
camel/toolkits/hybrid_browser_toolkit/unified_analyzer.js,sha256=
|
|
393
|
+
camel/toolkits/hybrid_browser_toolkit/unified_analyzer.js,sha256=wVZfG-c6NqqtZnz97yyklvQsqCEeUPLH3XnvgURhIV4,40817
|
|
394
394
|
camel/toolkits/open_api_specs/security_config.py,sha256=ZVnBa_zEifaE_ao2xsvV5majuJHpn2Tn7feMDOnj-eo,898
|
|
395
395
|
camel/toolkits/open_api_specs/biztoc/__init__.py,sha256=OKCZrQCDwaWtXIN_2rA9FSqEvgpQRieRoHh7Ek6N16A,702
|
|
396
396
|
camel/toolkits/open_api_specs/biztoc/ai-plugin.json,sha256=IJinQbLv5MFPGFwdN7PbOhwArFVExSEZdJspe-mOBIo,866
|
|
@@ -446,7 +446,7 @@ camel/verifiers/math_verifier.py,sha256=tA1D4S0sm8nsWISevxSN0hvSVtIUpqmJhzqfbuMo
|
|
|
446
446
|
camel/verifiers/models.py,sha256=GdxYPr7UxNrR1577yW4kyroRcLGfd-H1GXgv8potDWU,2471
|
|
447
447
|
camel/verifiers/physics_verifier.py,sha256=c1grrRddcrVN7szkxhv2QirwY9viIRSITWeWFF5HmLs,30187
|
|
448
448
|
camel/verifiers/python_verifier.py,sha256=ogTz77wODfEcDN4tMVtiSkRQyoiZbHPY2fKybn59lHw,20558
|
|
449
|
-
camel_ai-0.2.
|
|
450
|
-
camel_ai-0.2.
|
|
451
|
-
camel_ai-0.2.
|
|
452
|
-
camel_ai-0.2.
|
|
449
|
+
camel_ai-0.2.71a8.dist-info/METADATA,sha256=v1GZ0ttSR8kcp2jXjYxmz0SUh6EOf_eaR7QdoTP8BcY,50002
|
|
450
|
+
camel_ai-0.2.71a8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
451
|
+
camel_ai-0.2.71a8.dist-info/licenses/LICENSE,sha256=id0nB2my5kG0xXeimIu5zZrbHLS6EQvxvkKkzIHaT2k,11343
|
|
452
|
+
camel_ai-0.2.71a8.dist-info/RECORD,,
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
# you may not use this file except in compliance with the License.
|
|
4
|
-
# You may obtain a copy of the License at
|
|
5
|
-
#
|
|
6
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
#
|
|
8
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
# See the License for the specific language governing permissions and
|
|
12
|
-
# limitations under the License.
|
|
13
|
-
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
|
-
|
|
15
|
-
"""
|
|
16
|
-
Stealth configuration for browser automation to avoid bot detection.
|
|
17
|
-
|
|
18
|
-
This module contains all the configuration needed to make the browser
|
|
19
|
-
appear as a regular user browser rather than an automated one.
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
from typing import Any, Dict, List
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class StealthConfig:
|
|
26
|
-
"""Configuration class for stealth browser settings."""
|
|
27
|
-
|
|
28
|
-
@staticmethod
|
|
29
|
-
def get_launch_args() -> List[str]:
|
|
30
|
-
"""Get Chrome launch arguments for stealth mode.
|
|
31
|
-
|
|
32
|
-
Returns:
|
|
33
|
-
List[str]: Chrome command line arguments to avoid detection.
|
|
34
|
-
"""
|
|
35
|
-
return [
|
|
36
|
-
'--disable-blink-features=AutomationControlled',
|
|
37
|
-
'--disable-features=VizDisplayCompositor',
|
|
38
|
-
'--disable-ipc-flooding-protection',
|
|
39
|
-
'--disable-renderer-backgrounding',
|
|
40
|
-
'--disable-backgrounding-occluded-windows',
|
|
41
|
-
'--disable-dev-shm-usage',
|
|
42
|
-
'--disable-extensions',
|
|
43
|
-
'--disable-plugins',
|
|
44
|
-
'--disable-default-apps',
|
|
45
|
-
'--disable-sync',
|
|
46
|
-
'--no-default-browser-check',
|
|
47
|
-
'--no-first-run',
|
|
48
|
-
'--no-sandbox',
|
|
49
|
-
'--disable-setuid-sandbox',
|
|
50
|
-
'--disable-web-security',
|
|
51
|
-
'--disable-features=TranslateUI',
|
|
52
|
-
'--disable-features=BlinkGenPropertyTrees',
|
|
53
|
-
'--disable-component-extensions-with-background-pages',
|
|
54
|
-
]
|
|
55
|
-
|
|
56
|
-
@staticmethod
|
|
57
|
-
def get_context_options() -> Dict[str, Any]:
|
|
58
|
-
"""Get browser context options for stealth mode.
|
|
59
|
-
|
|
60
|
-
Returns:
|
|
61
|
-
Dict[str, Any]: Browser context configuration options.
|
|
62
|
-
"""
|
|
63
|
-
return {
|
|
64
|
-
'user_agent': (
|
|
65
|
-
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
|
|
66
|
-
'AppleWebKit/537.36 (KHTML, like Gecko) '
|
|
67
|
-
'Chrome/131.0.0.0 Safari/537.36'
|
|
68
|
-
),
|
|
69
|
-
'viewport': {'width': 1920, 'height': 1080},
|
|
70
|
-
'locale': 'en-US',
|
|
71
|
-
'timezone_id': 'America/New_York',
|
|
72
|
-
'geolocation': {'latitude': 40.7128, 'longitude': -74.0060},
|
|
73
|
-
'permissions': ['geolocation'],
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
@staticmethod
|
|
77
|
-
def get_http_headers() -> Dict[str, str]:
|
|
78
|
-
"""Get HTTP headers for stealth mode.
|
|
79
|
-
|
|
80
|
-
Returns:
|
|
81
|
-
Dict[str, str]: HTTP headers to appear more like a real browser.
|
|
82
|
-
"""
|
|
83
|
-
return {
|
|
84
|
-
'Accept': (
|
|
85
|
-
'text/html,application/xhtml+xml,application/xml;q=0.9,'
|
|
86
|
-
'image/avif,image/webp,image/apng,*/*;q=0.8,'
|
|
87
|
-
'application/signed-exchange;v=b3;q=0.7'
|
|
88
|
-
),
|
|
89
|
-
'Accept-Language': 'en-US,en;q=0.9',
|
|
90
|
-
'Accept-Encoding': 'gzip, deflate, br, zstd',
|
|
91
|
-
'Cache-Control': 'max-age=0',
|
|
92
|
-
'Sec-Ch-Ua': (
|
|
93
|
-
'"Google Chrome";v="131", "Chromium";v="131", '
|
|
94
|
-
'"Not=A?Brand";v="24"'
|
|
95
|
-
),
|
|
96
|
-
'Sec-Ch-Ua-Mobile': '?0',
|
|
97
|
-
'Sec-Ch-Ua-Platform': '"Windows"',
|
|
98
|
-
'Sec-Fetch-Dest': 'document',
|
|
99
|
-
'Sec-Fetch-Mode': 'navigate',
|
|
100
|
-
'Sec-Fetch-Site': 'none',
|
|
101
|
-
'Sec-Fetch-User': '?1',
|
|
102
|
-
'Upgrade-Insecure-Requests': '1',
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
@staticmethod
|
|
106
|
-
def get_all_config() -> Dict[str, Any]:
|
|
107
|
-
"""Get all stealth configuration in one dict.
|
|
108
|
-
|
|
109
|
-
Returns:
|
|
110
|
-
Dict[str, Any]: Complete stealth configuration.
|
|
111
|
-
"""
|
|
112
|
-
return {
|
|
113
|
-
'launch_args': StealthConfig.get_launch_args(),
|
|
114
|
-
'context_options': StealthConfig.get_context_options(),
|
|
115
|
-
'http_headers': StealthConfig.get_http_headers(),
|
|
116
|
-
}
|
|
File without changes
|
|
File without changes
|