yooke commited on
Commit
2f8e89f
·
verified ·
1 Parent(s): f8364bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -26,26 +26,26 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
26
 
27
  @tool
28
  def query_weather(location: str, days: int = 1) -> str:
29
- """查询指定地点的天气情况。
30
 
31
  Args:
32
- location (str): 要查询天气的地点名称,例如:"北京"、"上海"等城市名
33
- days (int, optional): 要查询的天数,默认为1天,最大3天
34
 
35
  Returns:
36
- str: 包含天气信息的字符串,包括温度、湿度、风速等数据
37
  """
38
 
39
  if days < 1 or days > 3:
40
  return "查询天数必须在1-3之间"
41
 
42
- # 使用wttr.in API,完全免费,无需API密钥
43
  base_url = "https://wttr.in/"
44
 
45
  # 构建API请求URL
46
  params = {
47
- "format": "j1", # 返回JSON格式
48
- "lang": "zh-cn" # 中文结果
49
  }
50
 
51
  try:
 
26
 
27
  @tool
28
  def query_weather(location: str, days: int = 1) -> str:
29
+ """查询指定地点的天气预报。
30
 
31
  Args:
32
+ location: 要查询天气的地点名称,如"北京"、"上海"等。
33
+ days: 要查询的天数,默认为1天。
34
 
35
  Returns:
36
+ 包含天气预报信息的字符串。
37
  """
38
 
39
  if days < 1 or days > 3:
40
  return "查询天数必须在1-3之间"
41
 
42
+ # 使用wttr
43
  base_url = "https://wttr.in/"
44
 
45
  # 构建API请求URL
46
  params = {
47
+ "format": "j1",
48
+ "lang": "zh-cn"
49
  }
50
 
51
  try: