adithyagv commited on
Commit
d60a7a4
·
verified ·
1 Parent(s): 4845db6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -10,6 +10,8 @@ import pycountry
10
  # Define your tools
11
  @tool
12
  def get_currency_from_timezone(timezone: str) -> str:
 
 
13
  """A tool that returns the official currency of the location specified in the timezone
14
  Args:
15
  timezone: A string representing a valid timezone as city. (e.g London)
@@ -24,6 +26,7 @@ def get_currency_from_timezone(timezone: str) -> str:
24
  try:
25
  country = pycountry.countries.search_fuzzy(country_name)[0]
26
  if hasattr(country, 'currencies'):
 
27
  return ", ".join(country.currencies) # Return currencies as a comma-separated string
28
  else:
29
  return f"No currency information found for {country_name}"
@@ -38,6 +41,8 @@ def get_currency_from_timezone(timezone: str) -> str:
38
 
39
  @tool
40
  def get_current_time_in_timezone(timezone: str) -> str:
 
 
41
  """A tool that fetches the current local time in a specified timezone.
42
  Args:
43
  timezone: A string representing a valid timezone (e.g., 'America/New_York').
@@ -45,6 +50,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
45
  try:
46
  tz = pytz.timezone(timezone)
47
  local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
 
48
  return f"The current local time in {timezone} is: {local_time}"
49
  except Exception as e:
50
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
 
10
  # Define your tools
11
  @tool
12
  def get_currency_from_timezone(timezone: str) -> str:
13
+ print(f"get_currency_from_timezone called with timezone: {timezone}") # ADD THIS LINE
14
+
15
  """A tool that returns the official currency of the location specified in the timezone
16
  Args:
17
  timezone: A string representing a valid timezone as city. (e.g London)
 
26
  try:
27
  country = pycountry.countries.search_fuzzy(country_name)[0]
28
  if hasattr(country, 'currencies'):
29
+ print(f"get_currency_from_timezone returning currency: {currency_info}")
30
  return ", ".join(country.currencies) # Return currencies as a comma-separated string
31
  else:
32
  return f"No currency information found for {country_name}"
 
41
 
42
  @tool
43
  def get_current_time_in_timezone(timezone: str) -> str:
44
+ print(f"get_current_time_in_timezone called with timezone: {timezone}") # ADD THIS LINE
45
+
46
  """A tool that fetches the current local time in a specified timezone.
47
  Args:
48
  timezone: A string representing a valid timezone (e.g., 'America/New_York').
 
50
  try:
51
  tz = pytz.timezone(timezone)
52
  local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
53
+ print(f"get_current_time_in_timezone returning time: {local_time_str}")
54
  return f"The current local time in {timezone} is: {local_time}"
55
  except Exception as e:
56
  return f"Error fetching time for timezone '{timezone}': {str(e)}"