Spaces:
Sleeping
Sleeping
Update tools/visit_webpage.py
Browse files- tools/visit_webpage.py +2 -1
tools/visit_webpage.py
CHANGED
@@ -3,6 +3,7 @@ from smolagents.tools import Tool
|
|
3 |
import requests
|
4 |
import markdownify
|
5 |
import smolagents
|
|
|
6 |
|
7 |
class VisitWebpageTool(Tool):
|
8 |
name = "visit_webpage"
|
@@ -30,7 +31,7 @@ class VisitWebpageTool(Tool):
|
|
30 |
markdown_content = markdownify(response.text).strip()
|
31 |
|
32 |
# Remove multiple line breaks
|
33 |
-
markdown_content =
|
34 |
|
35 |
return truncate_content(markdown_content, 10000)
|
36 |
|
|
|
3 |
import requests
|
4 |
import markdownify
|
5 |
import smolagents
|
6 |
+
import re
|
7 |
|
8 |
class VisitWebpageTool(Tool):
|
9 |
name = "visit_webpage"
|
|
|
31 |
markdown_content = markdownify(response.text).strip()
|
32 |
|
33 |
# Remove multiple line breaks
|
34 |
+
markdown_content = re.sub(r"\n{3,}", "\n\n", markdown_content)
|
35 |
|
36 |
return truncate_content(markdown_content, 10000)
|
37 |
|