Skip to content

Commit 1077847

Browse files
authored
fix: remove file modify check for auto retriever (#1114)
1 parent d508eda commit 1077847

File tree

8 files changed

+22
-108
lines changed

8 files changed

+22
-108
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ body:
2626
attributes:
2727
label: What version of camel are you using?
2828
description: Run command `python3 -c 'print(__import__("camel").__version__)'` in your shell and paste the output here.
29-
placeholder: E.g., 0.2.4a
29+
placeholder: E.g., 0.2.4a1
3030
validations:
3131
required: true
3232

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ conda create --name camel python=3.10
116116
conda activate camel
117117
118118
# Clone github repo
119-
git clone -b v0.2.4a https://github.com/camel-ai/camel.git
119+
git clone -b v0.2.4a1 https://github.com/camel-ai/camel.git
120120
121121
# Change directory into project directory
122122
cd camel

camel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# limitations under the License.
1313
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
1414

15-
__version__ = '0.2.4a'
15+
__version__ = '0.2.4a1'
1616

1717
__all__ = [
1818
'__version__',

camel/retrievers/auto_retriever.py

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
14-
import datetime
15-
import os
1614
import re
1715
import uuid
1816
from typing import (
@@ -31,7 +29,6 @@
3129
BaseVectorStorage,
3230
MilvusStorage,
3331
QdrantStorage,
34-
VectorDBQuery,
3532
)
3633
from camel.types import StorageType
3734
from camel.utils import Constants
@@ -126,62 +123,6 @@ def _collection_name_generator(
126123

127124
return collection_name
128125

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-
185126
def run_vector_retriever(
186127
self,
187128
query: str,
@@ -246,34 +187,7 @@ def run_vector_retriever(
246187
collection_name
247188
)
248189

249-
# Check the modified time of the input file path, only works
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:
277191
# Clear the vector storage
278192
vector_storage_instance.clear()
279193
# Process and store the content to the vector storage

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
project = 'CAMEL'
2828
copyright = '2024, CAMEL-AI.org'
2929
author = 'CAMEL-AI.org'
30-
release = '0.2.4a'
30+
release = '0.2.4a1'
3131

3232
html_favicon = (
3333
'https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'

docs/get_started/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ conda create --name camel python=3.10
6060
conda activate camel
6161
6262
# Clone github repo
63-
git clone -b v0.2.4a https://github.com/camel-ai/camel.git
63+
git clone -b v0.2.4a1 https://github.com/camel-ai/camel.git
6464
6565
# Change directory into project directory
6666
cd camel

poetry.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "camel-ai"
7-
version = "0.2.4a"
7+
version = "0.2.4a1"
88
authors = ["CAMEL-AI.org"]
99
description = "Communicative Agents for AI Society Study"
1010
readme = "README.md"

0 commit comments

Comments
 (0)