jayur commited on
Commit
206700d
·
verified ·
1 Parent(s): a9b7ffa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
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
- search = DuckDuckGoSearchRun()
20
- indicator_val = search.invoke(f"What is the {indicator} of {country}")
21
- return f"The {indicator} of {country} is : {indicator_val}"
 
 
 
 
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: