Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,16 +19,16 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
@tool
|
| 22 |
-
def
|
| 23 |
-
"""Get the
|
| 24 |
Args:
|
| 25 |
-
|
| 26 |
"""
|
| 27 |
try:
|
| 28 |
|
| 29 |
search_tool = DuckDuckGoSearchTool(max_results=10)
|
| 30 |
results = search_tool.forward(
|
| 31 |
-
f"""Get the
|
| 32 |
)
|
| 33 |
|
| 34 |
if results:
|
|
@@ -37,7 +37,7 @@ def get_latest_news(topic: str) -> str:
|
|
| 37 |
else:
|
| 38 |
return "No results found."
|
| 39 |
except requests.exceptions.RequestException as e:
|
| 40 |
-
return f"Error: Failed to fetch
|
| 41 |
except Exception as e:
|
| 42 |
return f"Error: An unexpected error occurred: {str(e)}"
|
| 43 |
|
|
@@ -79,7 +79,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 79 |
|
| 80 |
agent = CodeAgent(
|
| 81 |
model=model,
|
| 82 |
-
tools=[final_answer,
|
| 83 |
max_steps=6,
|
| 84 |
verbosity_level=1,
|
| 85 |
grammar=None,
|
|
|
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
@tool
|
| 22 |
+
def get_trending_topic(country: str) -> str:
|
| 23 |
+
"""Get the most trending topic in a country
|
| 24 |
Args:
|
| 25 |
+
country: Name of the country
|
| 26 |
"""
|
| 27 |
try:
|
| 28 |
|
| 29 |
search_tool = DuckDuckGoSearchTool(max_results=10)
|
| 30 |
results = search_tool.forward(
|
| 31 |
+
f"""Get the most trending topic in the {country}"""
|
| 32 |
)
|
| 33 |
|
| 34 |
if results:
|
|
|
|
| 37 |
else:
|
| 38 |
return "No results found."
|
| 39 |
except requests.exceptions.RequestException as e:
|
| 40 |
+
return f"Error: Failed to fetch any topic: {str(e)}"
|
| 41 |
except Exception as e:
|
| 42 |
return f"Error: An unexpected error occurred: {str(e)}"
|
| 43 |
|
|
|
|
| 79 |
|
| 80 |
agent = CodeAgent(
|
| 81 |
model=model,
|
| 82 |
+
tools=[final_answer, get_trending_topic, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
|
| 83 |
max_steps=6,
|
| 84 |
verbosity_level=1,
|
| 85 |
grammar=None,
|