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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -15
app.py CHANGED
@@ -9,25 +9,17 @@ from Gradio_UI import GradioUI
9
 
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
- #Keep this format for the description / args / args description but feel free to modify the tool
14
- """A tool to search for information about cryptocurrency addresses from DuckDuckGo
15
  Args:
16
  addr: A string representing a valid cryptocurrency address.
17
  """
18
  try:
19
- ddg = DuckDuckGoSearchTool()
 
20
  query = f'cryptocurrency address "{addr}"'
21
- results = ddg.run(query=query, max_reults=1)
22
-
23
- if not results:
24
- return "No results found."
25
- top = results[0]
26
- title = top.get('title', '')
27
- link = top.get('ling', '')
28
- snippet = top.get('snippet', '')
29
-
30
- return f"{title}\n{snippet}\n{link}".strip()
31
  except Exception as e:
32
  return f"Search error: {str(e)}"
33
 
@@ -48,7 +40,6 @@ def get_current_time_in_timezone(timezone: str) -> str:
48
 
49
 
50
  final_answer = FinalAnswerTool()
51
- crypto_duck = crypto_duck()
52
 
53
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
54
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
 
9
 
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
 
 
40
 
41
 
42
  final_answer = FinalAnswerTool()
 
43
 
44
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
45
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'