yetessam commited on
Commit
185a3f4
·
verified ·
1 Parent(s): 5feb0eb

Update tools/web_search.py

Browse files
Files changed (1) hide show
  1. tools/web_search.py +12 -12
tools/web_search.py CHANGED
@@ -36,18 +36,18 @@ class DuckDuckGoSearchTool(Tool):
36
  raise RuntimeError("No results found. Try a broader/simpler query.")
37
 
38
  results: List[Dict[str, str]] = []
39
- for it in items:
40
- href = (it.get("href") or "").strip()
41
- if not href:
42
- continue # skip malformed entries without a URL
43
- results.append(
44
- {
45
- "title": str(it.get("title", "")),
46
- "url": href, # normalized key name
47
- "snippet": str(it.get("body", "")),
48
- }
49
- )
50
-
51
 
52
  if not results:
53
  raise RuntimeError("Results were returned but none contained valid URLs.")
 
36
  raise RuntimeError("No results found. Try a broader/simpler query.")
37
 
38
  results: List[Dict[str, str]] = []
39
+ for it in items:
40
+ href = (it.get("href") or "").strip()
41
+ if not href:
42
+ continue # skip malformed entries without a URL
43
+ results.append(
44
+ {
45
+ "title": str(it.get("title", "")),
46
+ "url": href, # normalized key name
47
+ "snippet": str(it.get("body", "")),
48
+ }
49
+ )
50
+
51
 
52
  if not results:
53
  raise RuntimeError("Results were returned but none contained valid URLs.")