ArslanFOX commited on
Commit
4711b64
·
verified ·
1 Parent(s): f73f8cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -0
app.py CHANGED
@@ -10,6 +10,14 @@ from langdetect import detect
10
 
11
  @tool
12
  def get_timezone_by_city(city: str) -> str:
 
 
 
 
 
 
 
 
13
  if not isinstance(city, str):
14
  return f"Error: Expected a string for city, got: {type(city)}"
15
  try:
@@ -30,6 +38,14 @@ def get_timezone_by_city(city: str) -> str:
30
 
31
  @tool
32
  def get_current_time_in_timezone(timezone: str) -> str:
 
 
 
 
 
 
 
 
33
  if not isinstance(timezone, str):
34
  return f"Error: Expected a string for timezone, got: {type(timezone)}"
35
  try:
@@ -41,6 +57,15 @@ def get_current_time_in_timezone(timezone: str) -> str:
41
 
42
  @tool
43
  def get_air_quality(city: str, lang: str = "en") -> str:
 
 
 
 
 
 
 
 
 
44
  if not isinstance(city, str):
45
  return f"Error: Expected a string for city, got: {type(city)}"
46
  try:
@@ -93,6 +118,15 @@ def get_air_quality(city: str, lang: str = "en") -> str:
93
 
94
  @tool
95
  def get_weather(city: str, lang: str = "en") -> str:
 
 
 
 
 
 
 
 
 
96
  if not isinstance(city, str):
97
  return f"Error: Expected a string for city, got: {type(city)}"
98
  try:
@@ -159,6 +193,14 @@ def get_weather(city: str, lang: str = "en") -> str:
159
 
160
  @tool
161
  def final_answer(answer: str) -> str:
 
 
 
 
 
 
 
 
162
  return answer
163
 
164
  try:
 
10
 
11
  @tool
12
  def get_timezone_by_city(city: str) -> str:
13
+ """Fetches the timezone for a given city using geolocation.
14
+
15
+ Args:
16
+ city: A string representing the city name, optionally with region or country (e.g., 'Бураево', 'Sydney').
17
+
18
+ Returns:
19
+ A string with the timezone (e.g., 'Europe/Moscow') or an error message.
20
+ """
21
  if not isinstance(city, str):
22
  return f"Error: Expected a string for city, got: {type(city)}"
23
  try:
 
38
 
39
  @tool
40
  def get_current_time_in_timezone(timezone: str) -> str:
41
+ """Fetches the current local time in a specified timezone.
42
+
43
+ Args:
44
+ timezone: A string representing a valid timezone (e.g., 'Europe/Moscow').
45
+
46
+ Returns:
47
+ A string with the current time (e.g., '2025-05-03 12:00:00') or an error message.
48
+ """
49
  if not isinstance(timezone, str):
50
  return f"Error: Expected a string for timezone, got: {type(timezone)}"
51
  try:
 
57
 
58
  @tool
59
  def get_air_quality(city: str, lang: str = "en") -> str:
60
+ """Fetches air quality data for a given city using OpenWeatherMap API.
61
+
62
+ Args:
63
+ city: A string representing the city name (e.g., 'Бирск', 'Sydney').
64
+ lang: A string representing the language code (e.g., 'en', 'ru').
65
+
66
+ Returns:
67
+ A string with air quality index (AQI) and pollutant levels or an error message.
68
+ """
69
  if not isinstance(city, str):
70
  return f"Error: Expected a string for city, got: {type(city)}"
71
  try:
 
118
 
119
  @tool
120
  def get_weather(city: str, lang: str = "en") -> str:
121
+ """Fetches weather data for a given city using OpenWeatherMap API.
122
+
123
+ Args:
124
+ city: A string representing the city name (e.g., 'Бирск', 'Sydney').
125
+ lang: A string representing the language code (e.g., 'en', 'ru').
126
+
127
+ Returns:
128
+ A string with weather conditions, temperature, and humidity or an error message.
129
+ """
130
  if not isinstance(city, str):
131
  return f"Error: Expected a string for city, got: {type(city)}"
132
  try:
 
193
 
194
  @tool
195
  def final_answer(answer: str) -> str:
196
+ """Returns the final answer.
197
+
198
+ Args:
199
+ answer: A string containing the final answer.
200
+
201
+ Returns:
202
+ The input answer string.
203
+ """
204
  return answer
205
 
206
  try: