W01fAI commited on
Commit
b6983f2
·
verified ·
1 Parent(s): 9b36ce2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -10,16 +10,18 @@ from Gradio_UI import GradioUI
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
  def crypto_duck(addr: str) -> str:
13
- """Search DuckDuckGo for information about a cryptocurrency address and return the top result(s).
14
  Args:
15
  addr: A string representing a valid cryptocurrency address.
16
  """
17
  try:
18
- # Limit to 1 result to keep it concise; increase if you want more
19
  ddg = DuckDuckGoSearchTool(max_results=1)
20
  query = f'cryptocurrency address "{addr}"'
21
- markdown_results = ddg(query)
22
- return markdown_results
 
 
 
23
  except Exception as e:
24
  return f"Search error: {str(e)}"
25
 
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
  def crypto_duck(addr: str) -> str:
13
+ """Search DuckDuckGo for information about a cryptocurrency address and return the top result.
14
  Args:
15
  addr: A string representing a valid cryptocurrency address.
16
  """
17
  try:
 
18
  ddg = DuckDuckGoSearchTool(max_results=1)
19
  query = f'cryptocurrency address "{addr}"'
20
+ markdown_results = ddg(query) # calls forward(query: str) -> str
21
+ # Optional: strip the markdown header if your forward adds it
22
+ if markdown_results.startswith("## Search Results"):
23
+ markdown_results = markdown_results.split("\n\n", 1)[-1]
24
+ return markdown_results or "No results found."
25
  except Exception as e:
26
  return f"Search error: {str(e)}"
27