Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

fix:Explicitly expose the errors that occur when the parse_file_or_url method of UnstructuredIO processes files. (#2083)

Tao Suneb79361b7b95
diff --git a/camel/loaders/unstructured_io.py b/camel/loaders/unstructured_io.py
index c86287c86..08ecda58c 100644
--- a/camel/loaders/unstructured_io.py
+++ b/camel/loaders/unstructured_io.py
@@ -11,6 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
+import traceback
import uuid
import warnings
from typing import (
@@ -151,7 +152,7 @@ class UnstructuredIO:
elements = partition(file=f, **kwargs)
return elements
except Exception:
- warnings.warn(f"Failed to partition the file: {input_path}")
+ warnings.warn(traceback.format_exc())
return None
@staticmethod
diff --git a/camel/memories/context_creators/score_based.py b/camel/memories/context_creators/score_based.py
index dfa0ba3d3..a8f7c3108 100644
--- a/camel/memories/context_creators/score_based.py
+++ b/camel/memories/context_creators/score_based.py
@@ -168,8 +168,8 @@ class ScoreBasedContextCreator(BaseContextCreator):
# 6. Output Assembly
# ======================
- # In case system message is the only message in memory when sorted units
- # are empty, raise an error
+ # In case system message is the only message in memory when sorted
+ # units are empty, raise an error
if system_unit and len(remaining_units) == 0 and len(records) > 1:
raise RuntimeError(
"System message and current message exceeds token limit ",
diff --git a/examples/loaders/apify_example.py b/examples/loaders/apify_example.py
index 83b5a57a4..bdf1a0192 100644
--- a/examples/loaders/apify_example.py
+++ b/examples/loaders/apify_example.py
@@ -48,19 +48,20 @@ print(dataset_result)
===============================================================================
[{'url': 'https://www.camel-ai.org/', 'crawl': {'loadedUrl': 'https://www.camel
-ai.org/', 'loadedTime': '2024-10-27T04:51:16.651Z', 'referrerUrl': 'https://ww
-w.camel-ai.org/', 'depth': 0, 'httpStatusCode': 200}, 'metadata': {'canonicalUr
-l': 'https://www.camel-ai.org/', 'title': 'CAMEL-AI', 'description': 'CAMEL-AI.
-org is the 1st LLM multi-agent framework and an open-source community dedicated
- to finding the scaling law of agents.', 'author': None, 'keywords': None, 'lan
- guageCode': 'en', 'openGraph': [{'property': 'og:title', 'content': 'CAMEL-AI'
- }, {'property': 'og:description', 'content': 'CAMEL-AI.org is the 1st LLM mult
- i-agent framework and an open-source community dedicated to finding the scaling
- g law of agents.'}, {'property': 'twitter:title', 'content': 'CAMEL-AI'}, {'pr
- operty': 'twitter:description', 'content': 'CAMEL-AI.org is the 1st LLM multi-
- agent framework and an open-source community dedicated to finding the scaling
- law of agents.'}, {'property': 'og:type', 'content': 'website'}], 'jsonLd': No
- ne, 'headers': {'date': 'Sun, 27 Oct 2024 04:50:18 GMT', 'content-type': 'text
- /html', 'cf-ray': '8d901082dae7efbe-PDX', 'cf-cache-status': 'HIT', 'age': '10
+w.camel-ai.org/', 'depth': 0, 'httpStatusCode': 200}, 'metadata':
+{'canonicalUrl': 'https://www.camel-ai.org/', 'title': 'CAMEL-AI',
+'description': 'CAMEL-AI.org is the 1st LLM multi-agent framework and an
+open-source community dedicated to finding the scaling law of agents.',
+'author': None, 'keywords': None, 'languageCode': 'en', 'openGraph':
+[{'property': 'og:title', 'content': 'CAMEL-AI'}, {'property':
+'og:description', 'content': 'CAMEL-AI.org is the 1st LLM multi-agent
+framework and an open-source community dedicated to finding the scaling law of
+agents.'}, {'property': 'twitter:title', 'content': 'CAMEL-AI'}, {'property':
+'twitter:description', 'content': 'CAMEL-AI.org is the 1st LLM multi-agent
+framework and an open-source community dedicated to finding the scaling law of
+agents.'}, {'property': 'og:type', 'content': 'website'}], 'jsonLd': None,
+'headers': {'date': 'Sun, 27 Oct 2024 04:50:18 GMT', 'content-type': 'text/
+html', 'cf-ray': '8d901082dae7efbe-PDX', 'cf-cache-status': 'HIT', 'age': '10
81', 'content-encoding': 'gzip', 'last-modified': 'Sat, 26 Oct 2024 11:51:32 G
MT', 'strict-transport-security': 'max-age=31536000', 'surrogate-control': 'ma
x-age=432000', 'surrogate-key': 'www.camel-ai.org 6659a154491a54a40551bc78 pag