Spaces:
Sleeping
Sleeping
Update functionalities.py
Browse files- functionalities.py +14 -14
functionalities.py
CHANGED
@@ -4,13 +4,11 @@ import requests
|
|
4 |
@tool
|
5 |
def suggest_outfit(occasion: str) -> str:
|
6 |
"""
|
7 |
-
Suggests an outfit based on the occasion.
|
8 |
Args:
|
9 |
-
occasion (str):
|
10 |
-
|
11 |
-
|
12 |
-
- "active": Outfit for doing sport.
|
13 |
-
- "custom": Custom outfit.
|
14 |
"""
|
15 |
if occasion == "casual":
|
16 |
return "T‑shirt, Jeans and sneakers."
|
@@ -24,11 +22,12 @@ def suggest_outfit(occasion: str) -> str:
|
|
24 |
@tool
|
25 |
def define_coordinates(city: str) -> dict:
|
26 |
"""
|
27 |
-
|
28 |
Args:
|
29 |
-
city (str):
|
30 |
-
Returns:
|
31 |
-
|
|
|
32 |
"""
|
33 |
city = city.strip()
|
34 |
if not city:
|
@@ -43,11 +42,12 @@ def define_coordinates(city: str) -> dict:
|
|
43 |
@tool
|
44 |
def get_weather(city: str) -> dict:
|
45 |
"""
|
46 |
-
|
47 |
Args:
|
48 |
-
city (str):
|
49 |
-
Returns:
|
50 |
-
|
|
|
51 |
"""
|
52 |
coords = define_coordinates(city)
|
53 |
if "error" in coords:
|
|
|
4 |
@tool
|
5 |
def suggest_outfit(occasion: str) -> str:
|
6 |
"""
|
7 |
+
Suggests an outfit based on the occasion type.
|
8 |
Args:
|
9 |
+
occasion (str): One of "casual", "formal", "active", or "custom".
|
10 |
+
Returns:
|
11 |
+
str: A recommended outfit description suitable for the occasion.
|
|
|
|
|
12 |
"""
|
13 |
if occasion == "casual":
|
14 |
return "T‑shirt, Jeans and sneakers."
|
|
|
22 |
@tool
|
23 |
def define_coordinates(city: str) -> dict:
|
24 |
"""
|
25 |
+
Looks up geographic coordinates and timezone for a city.
|
26 |
Args:
|
27 |
+
city (str): Name of the city to geocode.
|
28 |
+
Returns:
|
29 |
+
dict: Contains "latitude", "longitude", and "timezone",
|
30 |
+
or {"error": "..."} if lookup fails.
|
31 |
"""
|
32 |
city = city.strip()
|
33 |
if not city:
|
|
|
42 |
@tool
|
43 |
def get_weather(city: str) -> dict:
|
44 |
"""
|
45 |
+
Retrieves current weather (temp, wind, code, description) for a city.
|
46 |
Args:
|
47 |
+
city (str): Name of the city to fetch weather for.
|
48 |
+
Returns:
|
49 |
+
dict: Keys include "temperature", "wind_speed", "weather_code",
|
50 |
+
"description", and "summary", or {"error": "..."} if failure.
|
51 |
"""
|
52 |
coords = define_coordinates(city)
|
53 |
if "error" in coords:
|