alamanna commited on
Commit
0659dec
·
verified ·
1 Parent(s): 63e84d2

Update functionalities.py

Browse files

Added the docstring to the tools

Files changed (1) hide show
  1. functionalities.py +23 -1
functionalities.py CHANGED
@@ -3,6 +3,15 @@ import requests
3
 
4
  @tool
5
  def suggest_outfit(occasion: str) -> str:
 
 
 
 
 
 
 
 
 
6
  if occasion == "casual":
7
  return "T‑shirt, Jeans and sneakers."
8
  elif occasion == "formal":
@@ -14,7 +23,13 @@ def suggest_outfit(occasion: str) -> str:
14
 
15
  @tool
16
  def define_coordinates(city: str) -> dict:
17
- # calls Open‑Meteo geocoding API
 
 
 
 
 
 
18
  city = city.strip()
19
  if not city:
20
  return {"error": "City name cannot be empty."}
@@ -27,6 +42,13 @@ def define_coordinates(city: str) -> dict:
27
 
28
  @tool
29
  def get_weather(city: str) -> dict:
 
 
 
 
 
 
 
30
  coords = define_coordinates(city)
31
  if "error" in coords:
32
  return {"error": coords["error"]}
 
3
 
4
  @tool
5
  def suggest_outfit(occasion: str) -> str:
6
+ """
7
+ Suggests an outfit based on the occasion.
8
+ Args:
9
+ occasion (str): The type of occasion for the event. Allowed values are:
10
+ - "casual": Outfit for casual event.
11
+ - "formal": Outfit for formal event.
12
+ - "active": Outfit for doing sport.
13
+ - "custom": Custom outfit.
14
+ """
15
  if occasion == "casual":
16
  return "T‑shirt, Jeans and sneakers."
17
  elif occasion == "formal":
 
23
 
24
  @tool
25
  def define_coordinates(city: str) -> dict:
26
+ """
27
+ Returns a dictionary with the geographical coordinates of a city.
28
+ Args:
29
+ city (str): A city name.
30
+ Returns:
31
+ A dictionary with the latitude, longitude and timezone of the city
32
+ """
33
  city = city.strip()
34
  if not city:
35
  return {"error": "City name cannot be empty."}
 
42
 
43
  @tool
44
  def get_weather(city: str) -> dict:
45
+ """
46
+ Returns a dictionary with the current weather conditions in a city.
47
+ Args:
48
+ city (str): A city name.
49
+ Returns:
50
+ A dictionary with: temperature, wind_speed, weather_code, weather_description and a summary of the current weather.
51
+ """
52
  coords = define_coordinates(city)
53
  if "error" in coords:
54
  return {"error": coords["error"]}