camel-ai 0.2.72a8__py3-none-any.whl → 0.2.72a10__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/note_taking_toolkit.py +18 -29
- {camel_ai-0.2.72a8.dist-info → camel_ai-0.2.72a10.dist-info}/METADATA +1 -1
- {camel_ai-0.2.72a8.dist-info → camel_ai-0.2.72a10.dist-info}/RECORD +6 -6
- {camel_ai-0.2.72a8.dist-info → camel_ai-0.2.72a10.dist-info}/WHEEL +0 -0
- {camel_ai-0.2.72a8.dist-info → camel_ai-0.2.72a10.dist-info}/licenses/LICENSE +0 -0
camel/__init__.py
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
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 fcntl
|
|
15
14
|
import os
|
|
16
15
|
import time
|
|
17
16
|
from pathlib import Path
|
|
@@ -88,58 +87,48 @@ class NoteTakingToolkit(BaseToolkit):
|
|
|
88
87
|
return f"Error appending note: {e}"
|
|
89
88
|
|
|
90
89
|
def _load_registry(self) -> None:
|
|
91
|
-
r"""Load the note registry from file
|
|
90
|
+
r"""Load the note registry from file."""
|
|
92
91
|
max_retries = 5
|
|
93
92
|
retry_delay = 0.1
|
|
94
93
|
|
|
95
94
|
for attempt in range(max_retries):
|
|
96
95
|
try:
|
|
97
96
|
if self.registry_file.exists():
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
self.registry = (
|
|
103
|
-
content.split('\n') if content else []
|
|
104
|
-
)
|
|
105
|
-
finally:
|
|
106
|
-
fcntl.flock(f.fileno(), fcntl.LOCK_UN)
|
|
107
|
-
return
|
|
97
|
+
content = self.registry_file.read_text(
|
|
98
|
+
encoding='utf-8'
|
|
99
|
+
).strip()
|
|
100
|
+
self.registry = content.split('\n') if content else []
|
|
108
101
|
else:
|
|
109
102
|
self.registry = []
|
|
110
|
-
|
|
111
|
-
except IOError:
|
|
103
|
+
return
|
|
104
|
+
except (IOError, OSError):
|
|
112
105
|
if attempt < max_retries - 1:
|
|
113
106
|
time.sleep(retry_delay * (attempt + 1))
|
|
114
107
|
else:
|
|
108
|
+
# If all retries failed, initialize with empty registry
|
|
115
109
|
self.registry = []
|
|
116
|
-
except Exception:
|
|
117
|
-
self.registry = []
|
|
118
|
-
return
|
|
119
110
|
|
|
120
111
|
def _save_registry(self) -> None:
|
|
121
|
-
r"""Save the note registry to file
|
|
112
|
+
r"""Save the note registry to file using atomic write."""
|
|
122
113
|
max_retries = 5
|
|
123
114
|
retry_delay = 0.1
|
|
124
115
|
|
|
125
116
|
for attempt in range(max_retries):
|
|
126
117
|
try:
|
|
127
|
-
with
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
118
|
+
# Use atomic write with temporary file for all platforms
|
|
119
|
+
temp_file = self.registry_file.with_suffix('.tmp')
|
|
120
|
+
temp_file.write_text(
|
|
121
|
+
'\n'.join(self.registry), encoding='utf-8'
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
# Atomic rename - works on all platforms
|
|
125
|
+
temp_file.replace(self.registry_file)
|
|
135
126
|
return
|
|
136
|
-
except IOError:
|
|
127
|
+
except (IOError, OSError):
|
|
137
128
|
if attempt < max_retries - 1:
|
|
138
129
|
time.sleep(retry_delay * (attempt + 1))
|
|
139
130
|
else:
|
|
140
131
|
raise
|
|
141
|
-
except Exception:
|
|
142
|
-
pass
|
|
143
132
|
|
|
144
133
|
def _register_note(self, note_name: str) -> None:
|
|
145
134
|
r"""Register a new note in the registry with thread-safe operations."""
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
camel/__init__.py,sha256=
|
|
1
|
+
camel/__init__.py,sha256=q0lYqJdzEjRoerFvmRgsd0TXuTbJ0oBldqWm7llhdfY,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
|
|
@@ -353,7 +353,7 @@ camel/toolkits/meshy_toolkit.py,sha256=NbgdOBD3FYLtZf-AfonIv6-Q8-8DW129jsaP1PqI2
|
|
|
353
353
|
camel/toolkits/message_agent_toolkit.py,sha256=yWvAaxoxAvDEtD7NH7IkkHIyfWIYK47WZhn5E_RaxKo,22661
|
|
354
354
|
camel/toolkits/mineru_toolkit.py,sha256=vRX9LholLNkpbJ6axfEN4pTG85aWb0PDmlVy3rAAXhg,6868
|
|
355
355
|
camel/toolkits/networkx_toolkit.py,sha256=C7pUCZTzzGkFyqdkrmhRKpAHmHWfLKeuzYHC_BHPtbk,8826
|
|
356
|
-
camel/toolkits/note_taking_toolkit.py,sha256=
|
|
356
|
+
camel/toolkits/note_taking_toolkit.py,sha256=cp7uoSBMjiGy331Tdk2Bl6yqKSMGwws7rQJkq8tfTQs,10687
|
|
357
357
|
camel/toolkits/notion_toolkit.py,sha256=jmmVWk_WazRNWnx4r9DAvhFTAL-n_ige0tb32UHJ_ik,9752
|
|
358
358
|
camel/toolkits/open_api_toolkit.py,sha256=Venfq8JwTMQfzRzzB7AYmYUMEX35hW0BjIv_ozFMiNk,23316
|
|
359
359
|
camel/toolkits/openai_agent_toolkit.py,sha256=hT2ancdQigngAiY1LNnGJzZeiBDHUxrRGv6BdZTJizc,4696
|
|
@@ -450,7 +450,7 @@ camel/verifiers/math_verifier.py,sha256=tA1D4S0sm8nsWISevxSN0hvSVtIUpqmJhzqfbuMo
|
|
|
450
450
|
camel/verifiers/models.py,sha256=GdxYPr7UxNrR1577yW4kyroRcLGfd-H1GXgv8potDWU,2471
|
|
451
451
|
camel/verifiers/physics_verifier.py,sha256=c1grrRddcrVN7szkxhv2QirwY9viIRSITWeWFF5HmLs,30187
|
|
452
452
|
camel/verifiers/python_verifier.py,sha256=ogTz77wODfEcDN4tMVtiSkRQyoiZbHPY2fKybn59lHw,20558
|
|
453
|
-
camel_ai-0.2.
|
|
454
|
-
camel_ai-0.2.
|
|
455
|
-
camel_ai-0.2.
|
|
456
|
-
camel_ai-0.2.
|
|
453
|
+
camel_ai-0.2.72a10.dist-info/METADATA,sha256=H08WhbsP_OpTX9jJi7b96FF4U4TLn0DGXOPLMQvWrOI,50003
|
|
454
|
+
camel_ai-0.2.72a10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
455
|
+
camel_ai-0.2.72a10.dist-info/licenses/LICENSE,sha256=id0nB2my5kG0xXeimIu5zZrbHLS6EQvxvkKkzIHaT2k,11343
|
|
456
|
+
camel_ai-0.2.72a10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|