🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
fix: Add Error Handling for Arxiv to Text (#1362)
Harry Ye471ad810817f
diff --git a/camel/toolkits/arxiv_toolkit.py b/camel/toolkits/arxiv_toolkit.pyindex 7912aea8f..b686e79c6 100644--- a/camel/toolkits/arxiv_toolkit.py+++ b/camel/toolkits/arxiv_toolkit.py@@ -14,10 +14,13 @@from typing import Dict, Generator, List, Optional+from camel.logger import get_loggerfrom camel.toolkits.base import BaseToolkitfrom camel.toolkits.function_tool import FunctionToolfrom camel.utils import dependencies_required+logger = get_logger(__name__)+class ArxivToolkit(BaseToolkit):r"""A toolkit for interacting with the arXiv API to search and download@@ -98,10 +101,24 @@ class ArxivToolkit(BaseToolkit):"authors": [author.name for author in paper.authors],"entry_id": paper.entry_id,"summary": paper.summary,- # TODO: Use chunkr instead of atxiv_to_text for better- # performance- "paper_text": arxiv_to_text(paper.pdf_url),+ "pdf_url": paper.pdf_url,}++ # Extract text from the paper+ try:+ # TODO: Use chunkr instead of atxiv_to_text for better+ # performance and reliability+ text = arxiv_to_text(paper_info["pdf_url"])+ except Exception as e:+ logger.error(+ "Failed to extract text content from the PDF at "+ "the specified URL. "+ f"URL: {paper_info.get('pdf_url', 'Unknown')} | Error: {e}"+ )+ text = ""++ paper_info['paper_text'] = text+papers_data.append(paper_info)return papers_data