SilviuMatei commited on
Commit
8223481
·
verified ·
1 Parent(s): f08e10b

Update tools/getDeviceInfo.py

Browse files
Files changed (1) hide show
  1. tools/getDeviceInfo.py +7 -3
tools/getDeviceInfo.py CHANGED
@@ -13,9 +13,11 @@ class getDeviceInfo(Tool):
13
  name = "visit_webpage"
14
  description = "Visits a webpage at the given URL, reads its content as a markdown string, and extracts device information."
15
  inputs = {'url': {'type': 'string', 'description': 'The URL of the webpage to visit.'}}
16
- output_type = "dict"
 
 
 
17
 
18
- def forward(self, url: str) -> dict:
19
  try:
20
  import requests
21
  from markdownify import markdownify
@@ -65,10 +67,12 @@ class getDeviceInfo(Tool):
65
  device_info = page.evaluate(script)
66
  browser.close()
67
 
68
- return {
 
69
  "webpage_content": webpage_content,
70
  "device_info": device_info
71
  }
 
72
 
73
  def __init__(self, *args, **kwargs):
74
  self.is_initialized = False
 
13
  name = "visit_webpage"
14
  description = "Visits a webpage at the given URL, reads its content as a markdown string, and extracts device information."
15
  inputs = {'url': {'type': 'string', 'description': 'The URL of the webpage to visit.'}}
16
+ output_type = "json" # ✅ Fix: Use "json" instead of "dict"
17
+
18
+ def forward(self, url: str) -> str: # ✅ Return a JSON string
19
+ import json
20
 
 
21
  try:
22
  import requests
23
  from markdownify import markdownify
 
67
  device_info = page.evaluate(script)
68
  browser.close()
69
 
70
+ # ✅ Convert output to JSON string
71
+ result = {
72
  "webpage_content": webpage_content,
73
  "device_info": device_info
74
  }
75
+ return json.dumps(result) # ✅ Ensure return type matches "json"
76
 
77
  def __init__(self, *args, **kwargs):
78
  self.is_initialized = False