kdivriotis commited on
Commit
87fe55b
·
verified ·
1 Parent(s): 2e6563a

Fix 'get_weather' function

Browse files
Files changed (1) hide show
  1. app.py +3 -16
app.py CHANGED
@@ -8,27 +8,14 @@ import os
8
 
9
  from Gradio_UI import GradioUI
10
 
11
- # Below is an example of a tool that does nothing. Amaze us with your creativity !
12
- @tool
13
- def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
14
- #Keep this format for the description / args / args description but feel free to modify the tool
15
- """A tool that does nothing yet
16
- Args:
17
- arg1: the first argument
18
- arg2: the second argument
19
- """
20
- return "What magic will you build ?"
21
-
22
  @tool
23
  def get_weather(city: str) -> str:
24
  """
25
- A tool that fetches the current weather for a given city.
26
  Args:
27
- city (str): Name of the city.
28
- Returns:
29
- str: Weather description or error message.
30
  """
31
- api_key = "f0b344c8b3a80c96c6753b593d936659"
32
  base_url = "https://api.openweathermap.org/data/2.5/weather"
33
  params = {"q": city, "appid": api_key, "units": "metric", "lang": "en"}
34
 
 
8
 
9
  from Gradio_UI import GradioUI
10
 
 
 
 
 
 
 
 
 
 
 
 
11
  @tool
12
  def get_weather(city: str) -> str:
13
  """
14
+ A tool that fetches the current weather for the specified city.
15
  Args:
16
+ city (str): Name of the city (e.g. 'Athens', 'New York' etc.)
 
 
17
  """
18
+ api_key = os.getenv("OPEN_WEATHER_API")
19
  base_url = "https://api.openweathermap.org/data/2.5/weather"
20
  params = {"q": city, "appid": api_key, "units": "metric", "lang": "en"}
21