Spaces:
Sleeping
Sleeping
Updated get_top_ranked_team to include ID again
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
|
|
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
@@ -20,7 +21,7 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_top_ranked_team(division:str, gender:str)-> str:
|
| 23 |
-
"""A tool that fetches the name of the top ranked ream for a given division and gender.
|
| 24 |
Args:
|
| 25 |
division: A string representing the division. This can only take values from ["NCAA Division I", "NCAA Division II", "NCAA Division III].
|
| 26 |
gender: A string representing the gender. This can only take vaues from ["Women", "Men"].
|
|
@@ -34,9 +35,11 @@ def get_top_ranked_team(division:str, gender:str)-> str:
|
|
| 34 |
if response.status_code == 200:
|
| 35 |
data = response.json()
|
| 36 |
school_name = data.get("results", [{}])[0].get("schoolName", "No school name available")
|
| 37 |
-
|
|
|
|
|
|
|
| 38 |
else:
|
| 39 |
-
return "Error: Unable to fetch the school
|
| 40 |
|
| 41 |
@tool
|
| 42 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 1 |
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 2 |
+
from bs4 import BeautifulSoup
|
| 3 |
import datetime
|
| 4 |
import requests
|
| 5 |
import pytz
|
|
|
|
| 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"].
|
|
|
|
| 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."
|
| 43 |
|
| 44 |
@tool
|
| 45 |
def get_current_time_in_timezone(timezone: str) -> str:
|