Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,16 @@ SERPER_API_KEY = os.environ.get("SERPER_API_KEY")
|
|
| 9 |
|
| 10 |
@tool
|
| 11 |
def get_weather(lat: float, lon: float) -> dict | None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
url = f"https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={OPENWEATHER_API_KEY}&units=metric"
|
| 13 |
try:
|
| 14 |
response = requests.get(url)
|
|
|
|
| 9 |
|
| 10 |
@tool
|
| 11 |
def get_weather(lat: float, lon: float) -> dict | None:
|
| 12 |
+
"""
|
| 13 |
+
Gọi API OpenWeatherMap để lấy thông tin thời tiết theo tọa độ địa lý
|
| 14 |
+
|
| 15 |
+
Args:
|
| 16 |
+
lat (float): Vĩ độ của địa điểm
|
| 17 |
+
lon (float): Kinh độ của địa điểm
|
| 18 |
+
|
| 19 |
+
Returns:
|
| 20 |
+
dict: Dictionary chứa các thông số thời tiết hoặc None nếu có lỗi
|
| 21 |
+
"""
|
| 22 |
url = f"https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={OPENWEATHER_API_KEY}&units=metric"
|
| 23 |
try:
|
| 24 |
response = requests.get(url)
|