chris-clippd commited on
Commit
4da741c
·
verified ·
1 Parent(s): e3f8515

Updated get_top_ranked_team to return a dict

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -20,8 +20,8 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
20
  return "What magic will you build ?"
21
 
22
  @tool
23
- def get_top_ranked_team(division:str, gender:str)-> str:
24
- """A tool that fetches the name and ID of the top ranked ream for a given division and gender in the format "School Name: SCHOOL_NAME, School ID: SCHOOL_ID".
25
  Args:
26
  division: A string representing the division. This can only take values from ["NCAA Division I", "NCAA Division II", "NCAA Division III].
27
  gender: A string representing the gender. This can only take vaues from ["Women", "Men"].
@@ -34,9 +34,7 @@ def get_top_ranked_team(division:str, gender:str)-> str:
34
  response = requests.get(api_url, headers=headers)
35
  if response.status_code == 200:
36
  data = response.json()
37
- school_name = data.get("results", [{}])[0].get("schoolName", "No school name available")
38
- school_id = data.get("results", [{}])[0].get("schoolId", "No school name available")
39
- school_info = f"School name: {school_name}, School ID: {school_id}"
40
  return school_info
41
  else:
42
  return "Error: Unable to fetch the school."
 
20
  return "What magic will you build ?"
21
 
22
  @tool
23
+ def get_top_ranked_team(division:str, gender:str)-> dict:
24
+ """A tool that returns a dictionary of information (e.g. name, ID, events won etc.) about the top ranked ream for a given division and gender.
25
  Args:
26
  division: A string representing the division. This can only take values from ["NCAA Division I", "NCAA Division II", "NCAA Division III].
27
  gender: A string representing the gender. This can only take vaues from ["Women", "Men"].
 
34
  response = requests.get(api_url, headers=headers)
35
  if response.status_code == 200:
36
  data = response.json()
37
+ school_info = data.get("results", [{}])[0]
 
 
38
  return school_info
39
  else:
40
  return "Error: Unable to fetch the school."