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: Changed params format in markdown_crawl (#1363)

AveryYay447e7f98d8aa
diff --git a/camel/loaders/firecrawl_reader.py b/camel/loaders/firecrawl_reader.py
index 27b02019e..645df3f78 100644
--- a/camel/loaders/firecrawl_reader.py
+++ b/camel/loaders/firecrawl_reader.py
@@ -77,36 +77,6 @@ class Firecrawl:
except Exception as e:
raise RuntimeError(f"Failed to crawl the URL: {e}")
- def markdown_crawl(self, url: str) -> str:
- r"""Crawl a URL and all accessible subpages and return the content in
- Markdown format.
-
- Args:
- url (str): The URL to crawl.
-
- Returns:
- str: The content of the URL in Markdown format.
-
- Raises:
- RuntimeError: If the crawling process fails.
- """
-
- try:
- crawl_result = self.app.crawl_url(
- url,
- {'formats': ['markdown']},
- )
- if not isinstance(crawl_result, list):
- raise ValueError("Unexpected response format")
- markdown_contents = [
- result.get('markdown', '') for result in crawl_result
- ]
- return '\n'.join(markdown_contents)
- except Exception as e:
- raise RuntimeError(
- f"Failed to crawl the URL and retrieve markdown: {e}"
- )
-
def check_crawl_job(self, job_id: str) -> Dict:
r"""Check the status of a crawl job.
diff --git a/test/loaders/test_firecrawl.py b/test/loaders/test_firecrawl.py
index 503eb8eb9..1702996ae 100644
--- a/test/loaders/test_firecrawl.py
+++ b/test/loaders/test_firecrawl.py
@@ -61,35 +61,6 @@ def test_crawl_failure():
assert 'Failed to crawl the URL' in str(e)
-def test_markdown_crawl_success():
- with patch('firecrawl.FirecrawlApp') as MockFirecrawlApp:
- mock_app = MockFirecrawlApp.return_value
- firecrawl = Firecrawl(
- api_key='test_api_key', api_url='https://api.test.com'
- )
- url = 'https://example.com'
- response = [{'markdown': 'Markdown content'}]
- mock_app.crawl_url.return_value = response
-
- result = firecrawl.markdown_crawl(url)
- assert result == 'Markdown content'
-
-
-def test_markdown_crawl_failure():
- with patch('firecrawl.FirecrawlApp') as MockFirecrawlApp:
- mock_app = MockFirecrawlApp.return_value
- firecrawl = Firecrawl(
- api_key='test_api_key', api_url='https://api.test.com'
- )
- url = 'https://example.com'
- mock_app.crawl_url.side_effect = Exception('Error')
-
- try:
- firecrawl.markdown_crawl(url)
- except RuntimeError as e:
- assert 'Failed to crawl the URL and retrieve markdown' in str(e)
-
-
def test_check_crawl_job_success():
with patch('firecrawl.FirecrawlApp') as MockFirecrawlApp:
mock_app = MockFirecrawlApp.return_value