Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,21 +9,23 @@ from Gradio_UI import GradioUI
|
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
12 |
-
def get_weather(city:str)-> str:
|
13 |
-
"""A tool that returns the weather of a city
|
14 |
Args:
|
15 |
-
|
|
|
|
|
16 |
"""
|
17 |
-
city_coords = {
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
}
|
22 |
|
23 |
-
if city not in city_coords:
|
24 |
-
|
25 |
|
26 |
-
lat, lon = city_coords[city]
|
27 |
url = f"https://api.open-meteo.com/v1/forecast?latitude={lat}&longitude={lon}¤t_weather=true"
|
28 |
|
29 |
response = requests.get(url)
|
@@ -72,7 +74,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
72 |
|
73 |
agent = CodeAgent(
|
74 |
model=model,
|
75 |
-
tools=[final_answer, get_current_time_in_timezone, get_weather], ## add your tools here (don't remove final answer)
|
76 |
max_steps=6,
|
77 |
verbosity_level=1,
|
78 |
grammar=None,
|
|
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
12 |
+
def get_weather(city:str,lat: float, lng:float)-> str:
|
13 |
+
"""A tool that returns the weather of a city given its lattitude and longitude
|
14 |
Args:
|
15 |
+
city: city name
|
16 |
+
lat: city lattitude
|
17 |
+
lng: city longitude
|
18 |
"""
|
19 |
+
# city_coords = {
|
20 |
+
# "New York": (40.7128, -74.0060),
|
21 |
+
# "London": (51.5074, -0.1278),
|
22 |
+
# "Tokyo": (35.6895, 139.6917),
|
23 |
+
# }
|
24 |
|
25 |
+
# if city not in city_coords:
|
26 |
+
# return "City not found. Try New York, London, or Tokyo."
|
27 |
|
28 |
+
# lat, lon = city_coords[city]
|
29 |
url = f"https://api.open-meteo.com/v1/forecast?latitude={lat}&longitude={lon}¤t_weather=true"
|
30 |
|
31 |
response = requests.get(url)
|
|
|
74 |
|
75 |
agent = CodeAgent(
|
76 |
model=model,
|
77 |
+
tools=[final_answer, get_current_time_in_timezone, search_tool, get_weather], ## add your tools here (don't remove final answer)
|
78 |
max_steps=6,
|
79 |
verbosity_level=1,
|
80 |
grammar=None,
|