Spaces:
Sleeping
Sleeping
Fixed re instead of requests in visit_webpage, imported re
Browse files
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.ipynb_checkpoints/
|
tools/.ipynb_checkpoints/visit_webpage-checkpoint.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from typing import Any, Optional
|
2 |
from smolagents.tools import Tool
|
3 |
import requests
|
|
|
4 |
import markdownify
|
5 |
import smolagents
|
6 |
|
@@ -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 |
|
|
|
1 |
from typing import Any, Optional
|
2 |
from smolagents.tools import Tool
|
3 |
import requests
|
4 |
+
import re
|
5 |
import markdownify
|
6 |
import smolagents
|
7 |
|
|
|
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 |
|
tools/visit_webpage.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from typing import Any, Optional
|
2 |
from smolagents.tools import Tool
|
3 |
import requests
|
|
|
4 |
import markdownify
|
5 |
import smolagents
|
6 |
|
@@ -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 |
|
|
|
1 |
from typing import Any, Optional
|
2 |
from smolagents.tools import Tool
|
3 |
import requests
|
4 |
+
import re
|
5 |
import markdownify
|
6 |
import smolagents
|
7 |
|
|
|
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 |
|