Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 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 |
-
|
|
|
|
| 20 |
query = f'cryptocurrency address "{addr}"'
|
| 21 |
-
|
| 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'
|