camel-ai 0.2.53__py3-none-any.whl → 0.2.54__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/models/mistral_model.py +1 -1
- camel/utils/__init__.py +2 -0
- camel/utils/commons.py +63 -0
- {camel_ai-0.2.53.dist-info → camel_ai-0.2.54.dist-info}/METADATA +1 -1
- {camel_ai-0.2.53.dist-info → camel_ai-0.2.54.dist-info}/RECORD +8 -8
- {camel_ai-0.2.53.dist-info → camel_ai-0.2.54.dist-info}/WHEEL +0 -0
- {camel_ai-0.2.53.dist-info → camel_ai-0.2.54.dist-info}/licenses/LICENSE +0 -0
camel/__init__.py
CHANGED
camel/models/mistral_model.py
CHANGED
|
@@ -95,7 +95,7 @@ class MistralModel(BaseModelBackend):
|
|
|
95
95
|
model_type, model_config_dict, api_key, url, token_counter, timeout
|
|
96
96
|
)
|
|
97
97
|
self._client = Mistral(
|
|
98
|
-
timeout_ms=int(self._timeout)
|
|
98
|
+
timeout_ms=int(self._timeout * 1000)
|
|
99
99
|
if self._timeout is not None
|
|
100
100
|
else None,
|
|
101
101
|
api_key=self._api_key,
|
camel/utils/__init__.py
CHANGED
|
@@ -17,6 +17,7 @@ from .commons import (
|
|
|
17
17
|
BatchProcessor,
|
|
18
18
|
agentops_decorator,
|
|
19
19
|
api_keys_required,
|
|
20
|
+
browser_toolkit_save_auth_cookie,
|
|
20
21
|
check_server_running,
|
|
21
22
|
create_chunks,
|
|
22
23
|
dependencies_required,
|
|
@@ -92,4 +93,5 @@ __all__ = [
|
|
|
92
93
|
"with_timeout",
|
|
93
94
|
"MCPServer",
|
|
94
95
|
"sanitize_filename",
|
|
96
|
+
"browser_toolkit_save_auth_cookie",
|
|
95
97
|
]
|
camel/utils/commons.py
CHANGED
|
@@ -1040,3 +1040,66 @@ def with_timeout(timeout=None):
|
|
|
1040
1040
|
return decorator(func)
|
|
1041
1041
|
|
|
1042
1042
|
return decorator
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
def browser_toolkit_save_auth_cookie(
|
|
1046
|
+
cookie_json_path: str, url: str, wait_time: int = 60
|
|
1047
|
+
):
|
|
1048
|
+
r"""Saves authentication cookies and browser storage state to a JSON file.
|
|
1049
|
+
|
|
1050
|
+
This function launches a browser window and navigates to the specified URL,
|
|
1051
|
+
allowing the user to manually authenticate (log in) during a 60-second
|
|
1052
|
+
wait period.After authentication, it saves all cookies, localStorage, and
|
|
1053
|
+
sessionStorage data to the specified JSON file path, which can be used
|
|
1054
|
+
later to maintain authenticated sessions without requiring manual login.
|
|
1055
|
+
|
|
1056
|
+
Args:
|
|
1057
|
+
cookie_json_path (str): Path where the authentication cookies and
|
|
1058
|
+
storage state will be saved as a JSON file. If the file already
|
|
1059
|
+
exists, it will be loaded first and then overwritten with updated
|
|
1060
|
+
state. The function checks if this file exists before attempting
|
|
1061
|
+
to use it.
|
|
1062
|
+
url (str): The URL to navigate to for authentication (e.g., a login
|
|
1063
|
+
page).
|
|
1064
|
+
wait_time (int): The time in seconds to wait for the user to manually
|
|
1065
|
+
authenticate.
|
|
1066
|
+
|
|
1067
|
+
Usage:
|
|
1068
|
+
1. The function opens a browser window and navigates to the specified
|
|
1069
|
+
URL
|
|
1070
|
+
2. User manually logs in during the wait_time wait period
|
|
1071
|
+
3. Browser storage state (including auth cookies) is saved to the
|
|
1072
|
+
specified file
|
|
1073
|
+
4. The saved state can be used in subsequent browser sessions to
|
|
1074
|
+
maintain authentication
|
|
1075
|
+
|
|
1076
|
+
Note:
|
|
1077
|
+
The wait_time sleep is intentional to give the user enough time to
|
|
1078
|
+
complete the manual authentication process before the storage state
|
|
1079
|
+
is captured.
|
|
1080
|
+
"""
|
|
1081
|
+
from playwright.sync_api import sync_playwright
|
|
1082
|
+
|
|
1083
|
+
playwright = sync_playwright().start()
|
|
1084
|
+
|
|
1085
|
+
# Launch visible browser window using Chromium
|
|
1086
|
+
browser = playwright.chromium.launch(headless=False, channel="chromium")
|
|
1087
|
+
|
|
1088
|
+
# Check if cookie file exists before using it
|
|
1089
|
+
storage_state = (
|
|
1090
|
+
cookie_json_path if os.path.exists(cookie_json_path) else None
|
|
1091
|
+
)
|
|
1092
|
+
|
|
1093
|
+
# Create browser context with proper typing
|
|
1094
|
+
context = browser.new_context(
|
|
1095
|
+
accept_downloads=True, storage_state=storage_state
|
|
1096
|
+
)
|
|
1097
|
+
page = context.new_page()
|
|
1098
|
+
page.goto(url) # Navigate to the authentication URL
|
|
1099
|
+
# Wait for page to fully load
|
|
1100
|
+
page.wait_for_load_state("load", timeout=1000)
|
|
1101
|
+
time.sleep(wait_time) # Wait 60 seconds for user to manually authenticate
|
|
1102
|
+
# Save browser storage state (cookies, localStorage, etc.) to JSON file
|
|
1103
|
+
context.storage_state(path=cookie_json_path)
|
|
1104
|
+
|
|
1105
|
+
browser.close() # Close the browser when finished
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
camel/__init__.py,sha256=
|
|
1
|
+
camel/__init__.py,sha256=6mC_LzkYTRDhA5zSGpvdPlBiTCWzoJKYiy2eQWFw4HU,912
|
|
2
2
|
camel/generators.py,sha256=JRqj9_m1PF4qT6UtybzTQ-KBT9MJQt18OAAYvQ_fr2o,13844
|
|
3
3
|
camel/human.py,sha256=9X09UmxI2JqQnhrFfnZ3B9EzFmVfdSWQcjLWTIXKXe0,4962
|
|
4
4
|
camel/logger.py,sha256=rZVeOVYuQ9RYJ5Tqyv0usqy0g4zaVEq4qSfZ9nd2640,5755
|
|
@@ -176,7 +176,7 @@ camel/models/groq_model.py,sha256=596VqRJ_yxv9Jz3sG7UVXVkIjZI1nX7zQAD709m4uig,37
|
|
|
176
176
|
camel/models/internlm_model.py,sha256=l7WjJ7JISCCqkezhEXzmjj_Mvhqhxxhsg4NuenP7w9w,4374
|
|
177
177
|
camel/models/litellm_model.py,sha256=rlSt3EnBAAYyoIxq0_XTuRmRnc4RWvD2Z14yIrI_7uw,5942
|
|
178
178
|
camel/models/lmstudio_model.py,sha256=_Lnv0e2ichks_MrNJGNIawEtGtP7T_xX8v0bFNNeWes,3641
|
|
179
|
-
camel/models/mistral_model.py,sha256=
|
|
179
|
+
camel/models/mistral_model.py,sha256=lsvfxhwp9aDGRpGKLt6Mwtnlw27jFp8AbpGw0UTHJds,12186
|
|
180
180
|
camel/models/model_factory.py,sha256=dS5K44jAa1atbicYwKfNFeSVGlgR97rNTQ74Gm_GMOE,12700
|
|
181
181
|
camel/models/model_manager.py,sha256=gfpL-WUxuTXgNeCkIVg8Y0zRvxMqRLX8JGt0XEAPQ8Y,9214
|
|
182
182
|
camel/models/modelscope_model.py,sha256=aI7i50DSIE6MO2U_WvULan6Sk4b5d7iZoEHQaARo4FA,10487
|
|
@@ -378,9 +378,9 @@ camel/types/openai_types.py,sha256=8ZFzLe-zGmKNPfuVZFzxlxAX98lGf18gtrPhOgMmzus,2
|
|
|
378
378
|
camel/types/unified_model_type.py,sha256=TpiUmJ3IuX8LNLtTUeUcVM7U82r4ClSq3ZQlNX3ODKs,5351
|
|
379
379
|
camel/types/agents/__init__.py,sha256=cbvVkogPoZgcwZrgxLH6EtpGXk0kavF79nOic0Dc1vg,786
|
|
380
380
|
camel/types/agents/tool_calling_record.py,sha256=qa-vLyKvYzWprRkFFl1928xaw9CnfacIebHaqM-oY3s,1814
|
|
381
|
-
camel/utils/__init__.py,sha256=
|
|
381
|
+
camel/utils/__init__.py,sha256=R2VaBRjYDslfF0qlPgE7-EIdcTNV-mQMWXbEAZ0CsuY,2815
|
|
382
382
|
camel/utils/async_func.py,sha256=KqoktGSWjZBuAMQ2CV0X6FRgHGlzCKLfeaWvp-f1Qz8,1568
|
|
383
|
-
camel/utils/commons.py,sha256=
|
|
383
|
+
camel/utils/commons.py,sha256=3XofL3nZ-tZ3DQLWmP41CAp8lT-ictBBsttJdRJjL4Q,36323
|
|
384
384
|
camel/utils/constants.py,sha256=cqnxmpUeOwrtsR-tRO4bbOc6ZP19TLj7avjm3FONMJs,1410
|
|
385
385
|
camel/utils/deduplication.py,sha256=UHikAtOW1TTDunf2t_wa2kFbmkrXWf7HfOKwLvwCxzo,8958
|
|
386
386
|
camel/utils/filename.py,sha256=HYNc1wbSCgNR1CN21cwHxdAhpnsf5ySJ6jUDfeqOK20,2532
|
|
@@ -397,7 +397,7 @@ camel/verifiers/math_verifier.py,sha256=tA1D4S0sm8nsWISevxSN0hvSVtIUpqmJhzqfbuMo
|
|
|
397
397
|
camel/verifiers/models.py,sha256=GdxYPr7UxNrR1577yW4kyroRcLGfd-H1GXgv8potDWU,2471
|
|
398
398
|
camel/verifiers/physics_verifier.py,sha256=c1grrRddcrVN7szkxhv2QirwY9viIRSITWeWFF5HmLs,30187
|
|
399
399
|
camel/verifiers/python_verifier.py,sha256=ogTz77wODfEcDN4tMVtiSkRQyoiZbHPY2fKybn59lHw,20558
|
|
400
|
-
camel_ai-0.2.
|
|
401
|
-
camel_ai-0.2.
|
|
402
|
-
camel_ai-0.2.
|
|
403
|
-
camel_ai-0.2.
|
|
400
|
+
camel_ai-0.2.54.dist-info/METADATA,sha256=d8FvLrmsbJjNmkNMBo5dUHjdCoWCxMn7Xt98QOgE-pY,44254
|
|
401
|
+
camel_ai-0.2.54.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
402
|
+
camel_ai-0.2.54.dist-info/licenses/LICENSE,sha256=id0nB2my5kG0xXeimIu5zZrbHLS6EQvxvkKkzIHaT2k,11343
|
|
403
|
+
camel_ai-0.2.54.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|