Sagar S commited on
Commit
b88a85c
·
verified ·
1 Parent(s): 6c2f739

try to fix response issue

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -4,14 +4,14 @@ import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
 
7
 
8
  from Gradio_UI import GradioUI
9
 
10
  @tool
11
- def get_country_data(country_name):
12
  """
13
  Fetches and prints data for a country from the REST Countries API.
14
-
15
  Args:
16
  country_name (str): The common name of the country (e.g., "France").
17
  """
@@ -35,7 +35,7 @@ def get_country_data(country_name):
35
  print(f"Capital: {country['capital'][0]}")
36
  print(f"Region: {country['region']}")
37
  print(f"Population: {country['population']:,}")
38
-
39
  except requests.exceptions.HTTPError as errh:
40
  print(f"HTTP Error: {errh}")
41
  except requests.exceptions.ConnectionError as errc:
@@ -49,7 +49,7 @@ def get_country_data(country_name):
49
  except Exception as e:
50
  print(f"An unexpected error occurred: {e}")
51
 
52
-
53
  @tool
54
  def get_current_time_in_timezone(timezone: str) -> str:
55
  """A tool that fetches the current local time in a specified timezone.
 
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
+ from typing import List, Dict
8
 
9
  from Gradio_UI import GradioUI
10
 
11
  @tool
12
+ def get_country_data(country_name) -> List[Dict]:
13
  """
14
  Fetches and prints data for a country from the REST Countries API.
 
15
  Args:
16
  country_name (str): The common name of the country (e.g., "France").
17
  """
 
35
  print(f"Capital: {country['capital'][0]}")
36
  print(f"Region: {country['region']}")
37
  print(f"Population: {country['population']:,}")
38
+ return data
39
  except requests.exceptions.HTTPError as errh:
40
  print(f"HTTP Error: {errh}")
41
  except requests.exceptions.ConnectionError as errc:
 
49
  except Exception as e:
50
  print(f"An unexpected error occurred: {e}")
51
 
52
+
53
  @tool
54
  def get_current_time_in_timezone(timezone: str) -> str:
55
  """A tool that fetches the current local time in a specified timezone.