camel-ai 0.2.3a2__py3-none-any.whl → 0.2.4__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/retrievers/auto_retriever.py +1 -87
- camel/storages/graph_storages/graph_element.py +4 -2
- {camel_ai-0.2.3a2.dist-info → camel_ai-0.2.4.dist-info}/METADATA +2 -2
- {camel_ai-0.2.3a2.dist-info → camel_ai-0.2.4.dist-info}/RECORD +7 -7
- {camel_ai-0.2.3a2.dist-info → camel_ai-0.2.4.dist-info}/LICENSE +0 -0
- {camel_ai-0.2.3a2.dist-info → camel_ai-0.2.4.dist-info}/WHEEL +0 -0
camel/__init__.py
CHANGED
|
@@ -11,8 +11,6 @@
|
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
13
|
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
|
|
14
|
-
import datetime
|
|
15
|
-
import os
|
|
16
14
|
import re
|
|
17
15
|
import uuid
|
|
18
16
|
from typing import (
|
|
@@ -31,7 +29,6 @@ from camel.storages import (
|
|
|
31
29
|
BaseVectorStorage,
|
|
32
30
|
MilvusStorage,
|
|
33
31
|
QdrantStorage,
|
|
34
|
-
VectorDBQuery,
|
|
35
32
|
)
|
|
36
33
|
from camel.types import StorageType
|
|
37
34
|
from camel.utils import Constants
|
|
@@ -126,62 +123,6 @@ class AutoRetriever:
|
|
|
126
123
|
|
|
127
124
|
return collection_name
|
|
128
125
|
|
|
129
|
-
def _get_file_modified_date_from_file(
|
|
130
|
-
self, content_input_path: str
|
|
131
|
-
) -> str:
|
|
132
|
-
r"""Retrieves the last modified date and time of a given file. This
|
|
133
|
-
function takes a file path as input and returns the last modified date
|
|
134
|
-
and time of that file.
|
|
135
|
-
|
|
136
|
-
Args:
|
|
137
|
-
content_input_path (str): The file path of the content whose
|
|
138
|
-
modified date is to be retrieved.
|
|
139
|
-
|
|
140
|
-
Returns:
|
|
141
|
-
str: The last modified time from file.
|
|
142
|
-
"""
|
|
143
|
-
mod_time = os.path.getmtime(content_input_path)
|
|
144
|
-
readable_mod_time = datetime.datetime.fromtimestamp(
|
|
145
|
-
mod_time
|
|
146
|
-
).isoformat(timespec='seconds')
|
|
147
|
-
return readable_mod_time
|
|
148
|
-
|
|
149
|
-
def _get_file_modified_date_from_storage(
|
|
150
|
-
self, vector_storage_instance: BaseVectorStorage
|
|
151
|
-
) -> str:
|
|
152
|
-
r"""Retrieves the last modified date and time of a given file. This
|
|
153
|
-
function takes vector storage instance as input and returns the last
|
|
154
|
-
modified date from the metadata.
|
|
155
|
-
|
|
156
|
-
Args:
|
|
157
|
-
vector_storage_instance (BaseVectorStorage): The vector storage
|
|
158
|
-
where modified date is to be retrieved from metadata.
|
|
159
|
-
|
|
160
|
-
Returns:
|
|
161
|
-
str: The last modified date from vector storage.
|
|
162
|
-
"""
|
|
163
|
-
|
|
164
|
-
# Insert any query to get modified date from vector db
|
|
165
|
-
# NOTE: Can be optimized when CAMEL vector storage support
|
|
166
|
-
# direct chunk payload extraction
|
|
167
|
-
query_vector_any = self.embedding_model.embed(obj="any_query")
|
|
168
|
-
query_any = VectorDBQuery(query_vector_any, top_k=1)
|
|
169
|
-
result_any = vector_storage_instance.query(query_any)
|
|
170
|
-
|
|
171
|
-
# Extract the file's last modified date from the metadata
|
|
172
|
-
# in the query result
|
|
173
|
-
if result_any[0].record.payload is not None:
|
|
174
|
-
file_modified_date_from_meta = result_any[0].record.payload[
|
|
175
|
-
"metadata"
|
|
176
|
-
]['last_modified']
|
|
177
|
-
else:
|
|
178
|
-
raise ValueError(
|
|
179
|
-
"The vector storage exits but the payload is None,"
|
|
180
|
-
"please check the collection"
|
|
181
|
-
)
|
|
182
|
-
|
|
183
|
-
return file_modified_date_from_meta
|
|
184
|
-
|
|
185
126
|
def run_vector_retriever(
|
|
186
127
|
self,
|
|
187
128
|
query: str,
|
|
@@ -246,34 +187,7 @@ class AutoRetriever:
|
|
|
246
187
|
collection_name
|
|
247
188
|
)
|
|
248
189
|
|
|
249
|
-
|
|
250
|
-
# for local path since no standard way for remote url
|
|
251
|
-
file_is_modified = False # initialize with a default value
|
|
252
|
-
if (
|
|
253
|
-
vector_storage_instance.status().vector_count != 0
|
|
254
|
-
and isinstance(content, str)
|
|
255
|
-
and os.path.exists(content)
|
|
256
|
-
):
|
|
257
|
-
# Get original modified date from file
|
|
258
|
-
modified_date_from_file = (
|
|
259
|
-
self._get_file_modified_date_from_file(content)
|
|
260
|
-
)
|
|
261
|
-
# Get modified date from vector storage
|
|
262
|
-
modified_date_from_storage = (
|
|
263
|
-
self._get_file_modified_date_from_storage(
|
|
264
|
-
vector_storage_instance
|
|
265
|
-
)
|
|
266
|
-
)
|
|
267
|
-
# Determine if the file has been modified since the last
|
|
268
|
-
# check
|
|
269
|
-
file_is_modified = (
|
|
270
|
-
modified_date_from_file != modified_date_from_storage
|
|
271
|
-
)
|
|
272
|
-
|
|
273
|
-
if (
|
|
274
|
-
vector_storage_instance.status().vector_count == 0
|
|
275
|
-
or file_is_modified
|
|
276
|
-
):
|
|
190
|
+
if vector_storage_instance.status().vector_count == 0:
|
|
277
191
|
# Clear the vector storage
|
|
278
192
|
vector_storage_instance.clear()
|
|
279
193
|
# Process and store the content to the vector storage
|
|
@@ -13,12 +13,14 @@
|
|
|
13
13
|
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
|
|
14
14
|
from __future__ import annotations
|
|
15
15
|
|
|
16
|
-
from typing import
|
|
16
|
+
from typing import List, Union
|
|
17
17
|
|
|
18
18
|
from pydantic import BaseModel, ConfigDict, Field
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
try:
|
|
21
21
|
from unstructured.documents.elements import Element
|
|
22
|
+
except ImportError:
|
|
23
|
+
Element = None # type:ignore[misc,assignment]
|
|
22
24
|
|
|
23
25
|
|
|
24
26
|
class Node(BaseModel):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: camel-ai
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Communicative Agents for AI Society Study
|
|
5
5
|
Home-page: https://www.camel-ai.org/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -221,7 +221,7 @@ conda create --name camel python=3.10
|
|
|
221
221
|
conda activate camel
|
|
222
222
|
|
|
223
223
|
# Clone github repo
|
|
224
|
-
git clone -b v0.2.
|
|
224
|
+
git clone -b v0.2.4 https://github.com/camel-ai/camel.git
|
|
225
225
|
|
|
226
226
|
# Change directory into project directory
|
|
227
227
|
cd camel
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
camel/__init__.py,sha256=
|
|
1
|
+
camel/__init__.py,sha256=EjotdyCjFfyNaFBmBi2ZFvixYQj9E1In8xs-Vk8wdfM,778
|
|
2
2
|
camel/agents/__init__.py,sha256=SSU1wbhZXWwQnE0rRxkpyN57kEu72KklsZNcdLkXfTs,1551
|
|
3
3
|
camel/agents/base.py,sha256=X39qWSiT1WnDqaJ9k3gQrTpOQSwUKzNEVpp5AY6fDH8,1130
|
|
4
4
|
camel/agents/chat_agent.py,sha256=eA7kuzbfQkEdnvefxk6t_-MhB64ibSgSiQ54ztiqvJI,44764
|
|
@@ -104,7 +104,7 @@ camel/prompts/video_description_prompt.py,sha256=HRd3fHXftKwBm5QH7Tvm3FabgZPCoAv
|
|
|
104
104
|
camel/responses/__init__.py,sha256=edtTQskOgq5obyITziRFL62HTJP9sAikAtP9vrFacEQ,795
|
|
105
105
|
camel/responses/agent_responses.py,sha256=sGlGwXz2brWI-FpiU5EhVRpZvcfGWUmooAF0ukqAF3I,1771
|
|
106
106
|
camel/retrievers/__init__.py,sha256=CuP3B77zl2PoF-W2y9xSkTGRzoK2J4TlUHdCtuJD8dg,1059
|
|
107
|
-
camel/retrievers/auto_retriever.py,sha256=
|
|
107
|
+
camel/retrievers/auto_retriever.py,sha256=EVbm0aTWcOZ8foZ-GY9-msuDoz0tBM5sOveWypy7A9M,9587
|
|
108
108
|
camel/retrievers/base.py,sha256=sgqaJDwIkWluEgPBlukFN7RYZJnrp0imCAOEWm6bZ40,2646
|
|
109
109
|
camel/retrievers/bm25_retriever.py,sha256=Dr7Yfkjw45sovI1EVNByGIMj7KERWrr8JHlh8csSF1s,5155
|
|
110
110
|
camel/retrievers/cohere_rerank_retriever.py,sha256=HvnFqXpsX9EdBOab0kFLDyxxJnknPFMVxyQJQDlHbOA,4100
|
|
@@ -115,7 +115,7 @@ camel/societies/role_playing.py,sha256=LSkYqNAFcKn9JNFLIEfoUTNP7cYeXaIzaIHcha9IM
|
|
|
115
115
|
camel/storages/__init__.py,sha256=erzsXX2rPVodgWxlV6hSjwmc4UCguzVb6m3ahBoyWu0,1623
|
|
116
116
|
camel/storages/graph_storages/__init__.py,sha256=YFwNjNYaxpKT2j5dxWZur62T8J0ZPER3DHaWGEAXgo8,954
|
|
117
117
|
camel/storages/graph_storages/base.py,sha256=-Ys1BIuz4H5FvYMZTBIjg8Cfv40CPQ-OsovwMzygEgU,2858
|
|
118
|
-
camel/storages/graph_storages/graph_element.py,sha256=
|
|
118
|
+
camel/storages/graph_storages/graph_element.py,sha256=sVzeg1waASCBTDEq9mxERJ8fqjKDLxoQTq2xfJ-RIGA,2623
|
|
119
119
|
camel/storages/graph_storages/nebula_graph.py,sha256=PFLI--kgC93Nt5kPFWH2DVqwvk2GrC--dr2bzwvmeXw,18863
|
|
120
120
|
camel/storages/graph_storages/neo4j_graph.py,sha256=YAT7u2jPs5pNSO_tSwARHJyt3HqYXpbpE4ZBtv935Kg,22138
|
|
121
121
|
camel/storages/key_value_storages/__init__.py,sha256=v3Wy3CAJNgrPyBV4miOC6TxQDL-PYdGW8HbqiYl7k00,968
|
|
@@ -202,7 +202,7 @@ camel/workforce/task_channel.py,sha256=WE3SHp5TKaXDzKnoul9KPfk-PkBMcGT6akVId0RtW
|
|
|
202
202
|
camel/workforce/utils.py,sha256=kBrjA_k9BblJBT13kW0eQYcBDjetyjOUHMbRuh_IfPM,2270
|
|
203
203
|
camel/workforce/worker.py,sha256=oZtl3PhxgpizKy7W_wB94Qm4Z2Tw4k1SQsqAGAi_XoI,3844
|
|
204
204
|
camel/workforce/workforce.py,sha256=IV911OlzSng_qR8KafFlDvkUEzEFa6A_upTgi8kZKxI,18191
|
|
205
|
-
camel_ai-0.2.
|
|
206
|
-
camel_ai-0.2.
|
|
207
|
-
camel_ai-0.2.
|
|
208
|
-
camel_ai-0.2.
|
|
205
|
+
camel_ai-0.2.4.dist-info/LICENSE,sha256=id0nB2my5kG0xXeimIu5zZrbHLS6EQvxvkKkzIHaT2k,11343
|
|
206
|
+
camel_ai-0.2.4.dist-info/METADATA,sha256=m5Fd1nE-YiPESkRE-UYAptVOVbYb5klB95mLKGajPDY,23181
|
|
207
|
+
camel_ai-0.2.4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
208
|
+
camel_ai-0.2.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|