captain24tyagi commited on
Commit
e2c3f0f
·
verified ·
1 Parent(s): 7c6817b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -18,6 +18,22 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
18
  """
19
  return "What magic will you build ?"
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
23
  """A tool that fetches the current local time in a specified timezone.
 
18
  """
19
  return "What magic will you build ?"
20
 
21
+ @tool
22
+ def get_weather(arg1: str) -> str:
23
+ #Takes location as argument and returns weather of that location
24
+ """A tool which provides weather details for a given location
25
+ Args:
26
+ location: A string representing location.
27
+ """
28
+
29
+ try:
30
+ w = http://api.weatherapi.com/v1/current.json?key=05d531810e4e4030ad0143523261804&q={arg1}&aqi=no
31
+ weather = w.current.temp_c
32
+ return f"The current temperature of {arg1} is: {weather}"
33
+ except Exception as e:
34
+ return f"Error current temperature of {arg1}: {str(e)}"
35
+
36
+
37
  @tool
38
  def get_current_time_in_timezone(timezone: str) -> str:
39
  """A tool that fetches the current local time in a specified timezone.