Khalil Guetari commited on
Commit
a90ba86
·
1 Parent(s): 68756ed

Fix import error

Browse files
__init__.py ADDED
File without changes
pyproject.toml CHANGED
@@ -19,3 +19,6 @@ license = {text = "MIT"}
19
 
20
  [tool.pdm]
21
  distribution = false
 
 
 
 
19
 
20
  [tool.pdm]
21
  distribution = false
22
+
23
+ [tool.pdm.scripts]
24
+ tools = {call = "tests.tools.test_visit_webpage:test_visit_webpage_tool" }
tests/__init__.py ADDED
File without changes
tests/tools/__init__.py ADDED
File without changes
tests/tools/test_visit_webpage.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from tools.visit_webpage import VisitWebpageTool
2
+
3
+
4
+ def test_visit_webpage_tool():
5
+ url = "https://www.everyculture.com/To-Z/Tunisia.html"
6
+ tool = VisitWebpageTool()
7
+ page = tool(url=url)
8
+ print(page)
tools/__init__.py ADDED
File without changes
tools/visit_webpage.py CHANGED
@@ -4,6 +4,7 @@ import requests
4
  import markdownify
5
  import smolagents
6
 
 
7
  class VisitWebpageTool(Tool):
8
  name = "visit_webpage"
9
  description = "Visits a webpage at the given url and reads its content as a markdown string. Use this to browse webpages."
@@ -12,6 +13,7 @@ class VisitWebpageTool(Tool):
12
 
13
  def forward(self, url: str) -> str:
14
  try:
 
15
  import requests
16
  from markdownify import markdownify
17
  from requests.exceptions import RequestException
 
4
  import markdownify
5
  import smolagents
6
 
7
+
8
  class VisitWebpageTool(Tool):
9
  name = "visit_webpage"
10
  description = "Visits a webpage at the given url and reads its content as a markdown string. Use this to browse webpages."
 
13
 
14
  def forward(self, url: str) -> str:
15
  try:
16
+ import re
17
  import requests
18
  from markdownify import markdownify
19
  from requests.exceptions import RequestException