Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,7 @@ from huggingface_hub import login
|
|
14 |
login(token = os.getenv('nangelov_hf_token'))
|
15 |
FOOTBALL_DATA_TOKEN = os.getenv('football_data_token')
|
16 |
|
|
|
17 |
def get_Competition_Code(competition_name: str)-> str:
|
18 |
"""A tool that returns the competition code for a given competition name.
|
19 |
Args:
|
@@ -44,18 +45,17 @@ def get_Competition_Code(competition_name: str)-> str:
|
|
44 |
return None
|
45 |
|
46 |
@tool
|
47 |
-
def search_Competition_Matches_Results_By_Date(
|
48 |
"""A tool that fetch football games results for a given competition from a specified date.
|
49 |
Args:
|
50 |
-
|
51 |
-
matchday:
|
52 |
"""
|
53 |
-
|
54 |
-
competition_code = get_Competition_Code(competition_name)
|
55 |
-
|
56 |
# Create the URL using an f-string
|
57 |
url = f'https://api.football-data.org/v4/competitions/{competition_code}/matches?matchday={matchday}'
|
58 |
print(url)
|
|
|
59 |
# Set up the headers with your API token.
|
60 |
headers = {
|
61 |
'X-Auth-Token': FOOTBALL_DATA_TOKEN
|
@@ -109,7 +109,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
109 |
|
110 |
agent = CodeAgent(
|
111 |
model=model,
|
112 |
-
tools=[final_answer, visit_webpage, search_Competition_Matches_Results_By_Date, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
|
113 |
max_steps=6,
|
114 |
verbosity_level=1,
|
115 |
grammar=None,
|
|
|
14 |
login(token = os.getenv('nangelov_hf_token'))
|
15 |
FOOTBALL_DATA_TOKEN = os.getenv('football_data_token')
|
16 |
|
17 |
+
@tool
|
18 |
def get_Competition_Code(competition_name: str)-> str:
|
19 |
"""A tool that returns the competition code for a given competition name.
|
20 |
Args:
|
|
|
45 |
return None
|
46 |
|
47 |
@tool
|
48 |
+
def search_Competition_Matches_Results_By_Date(competition_code: str, matchday: int)-> dict:
|
49 |
"""A tool that fetch football games results for a given competition from a specified date.
|
50 |
Args:
|
51 |
+
competition_code: A string representing the code of the competition, e.g., "Premier League" or "Bundesliga".
|
52 |
+
matchday: An integer representing the matchday for which to retrieve match results format: Integer /[1-4]+[0-9]*/.
|
53 |
"""
|
54 |
+
|
|
|
|
|
55 |
# Create the URL using an f-string
|
56 |
url = f'https://api.football-data.org/v4/competitions/{competition_code}/matches?matchday={matchday}'
|
57 |
print(url)
|
58 |
+
|
59 |
# Set up the headers with your API token.
|
60 |
headers = {
|
61 |
'X-Auth-Token': FOOTBALL_DATA_TOKEN
|
|
|
109 |
|
110 |
agent = CodeAgent(
|
111 |
model=model,
|
112 |
+
tools=[final_answer, visit_webpage, search_Competition_Matches_Results_By_Date, get_current_time_in_timezone, get_Competition_Code], ## add your tools here (don't remove final answer)
|
113 |
max_steps=6,
|
114 |
verbosity_level=1,
|
115 |
grammar=None,
|