Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,9 +16,13 @@ def my_custom_tool(country:str, indicator:str)->str: #it's import to specify the
|
|
| 16 |
country: Name of the country e.g. United States, India, China
|
| 17 |
indicator: the value of the statistic requested as a string e.g Population, GDP, Land area
|
| 18 |
"""
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
@tool
|
| 24 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 16 |
country: Name of the country e.g. United States, India, China
|
| 17 |
indicator: the value of the statistic requested as a string e.g Population, GDP, Land area
|
| 18 |
"""
|
| 19 |
+
try:
|
| 20 |
+
# Create DuckDuckGo web search object
|
| 21 |
+
search = DuckDuckGoSearchRun()
|
| 22 |
+
indicator_val = search.invoke(f"What is the {indicator} of {country}")
|
| 23 |
+
return f"The {indicator} of {country} is : {indicator_val}"
|
| 24 |
+
except Exception as e:
|
| 25 |
+
return f"Error: Search failed for {indicator} of {country}"
|
| 26 |
|
| 27 |
@tool
|
| 28 |
def get_current_time_in_timezone(timezone: str) -> str:
|