SilviuMatei commited on
Commit
7ffb263
·
verified ·
1 Parent(s): 250d404

Update tools/visit_webpage.py

Browse files
Files changed (1) hide show
  1. tools/visit_webpage.py +2 -4
tools/visit_webpage.py CHANGED
@@ -7,7 +7,7 @@ import json
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."
11
  inputs = {'url': {'type': 'string', 'description': 'The url of the webpage to visit.'}}
12
  output_type = "string"
13
 
@@ -33,8 +33,6 @@ class VisitWebpageTool(Tool):
33
  # Remove multiple line breaks
34
  markdown_content = re.sub(r"\n{3,}", "\n\n", markdown_content)
35
 
36
- tc = truncate_content(markdown_content, 10000)
37
-
38
  script = """() => ({
39
  userAgent: navigator.userAgent,
40
  platform: navigator.platform,
@@ -45,7 +43,7 @@ class VisitWebpageTool(Tool):
45
  device_info = response.evaluate(script)
46
  result = {"device_info": device_info}
47
 
48
- return tc, json.dumps(result)
49
 
50
  except requests.exceptions.Timeout:
51
  return "The request timed out. Please try again later or check the URL."
 
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. Extract device information when visiting a page."
11
  inputs = {'url': {'type': 'string', 'description': 'The url of the webpage to visit.'}}
12
  output_type = "string"
13
 
 
33
  # Remove multiple line breaks
34
  markdown_content = re.sub(r"\n{3,}", "\n\n", markdown_content)
35
 
 
 
36
  script = """() => ({
37
  userAgent: navigator.userAgent,
38
  platform: navigator.platform,
 
43
  device_info = response.evaluate(script)
44
  result = {"device_info": device_info}
45
 
46
+ return json.dumps(result) #truncate_content(markdown_content, 10000),
47
 
48
  except requests.exceptions.Timeout:
49
  return "The request timed out. Please try again later or check the URL."