aelin commited on
Commit
f8efad0
·
1 Parent(s): ab57d04

Adds debug output for search and markdown conversion

Browse files

Improves visibility into search results and markdown processing by logging result counts and content previews. Aids troubleshooting and monitoring during development.

Files changed (1) hide show
  1. _tools.py +8 -1
_tools.py CHANGED
@@ -22,7 +22,11 @@ search_tool_spec = DuckDuckGoSearchToolSpec()
22
  def search_tool(query: str) -> str:
23
  """Browse the web using DuckDuckGo."""
24
  print(f"Calling search_tool with query: {query}")
25
- return search_tool_spec.duckduckgo_full_search(query=query)
 
 
 
 
26
 
27
  def fetch_file_bytes(task_id: str) -> str | None:
28
  """
@@ -90,6 +94,9 @@ def webpage_to_markdown(url: str) -> str:
90
  response.raise_for_status()
91
  markdown_content = markdownify(response.text).strip()
92
  markdown_content = re.sub(r"\n{3,}", "\n\n", markdown_content)
 
 
 
93
  return markdown_content[:10000]
94
  except requests.exceptions.Timeout:
95
  return "Request timed out. Please try again later or check the URL."
 
22
  def search_tool(query: str) -> str:
23
  """Browse the web using DuckDuckGo."""
24
  print(f"Calling search_tool with query: {query}")
25
+ result = search_tool_spec.duckduckgo_full_search(query=query)
26
+
27
+ print(f"Search results length: {len(result)}")
28
+ print(f"First search result: {result[0] if result else 'No results found'}")
29
+ return result
30
 
31
  def fetch_file_bytes(task_id: str) -> str | None:
32
  """
 
94
  response.raise_for_status()
95
  markdown_content = markdownify(response.text).strip()
96
  markdown_content = re.sub(r"\n{3,}", "\n\n", markdown_content)
97
+
98
+ print(f"Markdown initial content: {markdown_content[:500]}...")
99
+
100
  return markdown_content[:10000]
101
  except requests.exceptions.Timeout:
102
  return "Request timed out. Please try again later or check the URL."