robertgil commited on
Commit
6c3c664
·
verified ·
1 Parent(s): ae7a494

new function added

Browse files
Files changed (1) hide show
  1. app.py +21 -6
app.py CHANGED
@@ -7,16 +7,30 @@ from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
9
 
 
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
- def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
13
  #Keep this format for the description / args / args description but feel free to modify the tool
14
- """A tool that does nothing yet
 
15
  Args:
16
- arg1: the first argument
17
- arg2: the second argument
18
  """
19
- return "What magic will you build ?"
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -44,6 +58,7 @@ max_tokens=2096,
44
  temperature=0.5,
45
  model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
46
  custom_role_conversions=None,
 
47
  )
48
 
49
 
@@ -55,7 +70,7 @@ with open("prompts.yaml", 'r') as stream:
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[final_answer], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
 
7
 
8
  from Gradio_UI import GradioUI
9
 
10
+ rapid_api_key=os.environ["RAPID_KEY"]
11
+
12
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
13
  @tool
14
+ def get_football_results(arg1:str, arg2:str)-> str: #it's import to specify the return type
15
  #Keep this format for the description / args / args description but feel free to modify the tool
16
+ """A tool that connect to an API that provides live football data and compares the stats of two teams in the English Premier League, then it returns a text response
17
+ where you should look for those football teams given, compare stats and provide a reflection on how both stack up.
18
  Args:
19
+ arg1: The first argument provides one of the football teams to check
20
+ arg2: The second football team to check
21
  """
22
+ url = "https://free-api-live-football-data.p.rapidapi.com/football-get-standing-home"
23
+
24
+ querystring = {"leagueid":"47"} #British Premier League
25
+
26
+ headers = {
27
+ "x-rapidapi-key": rapid_api_key,
28
+ "x-rapidapi-host": "free-api-live-football-data.p.rapidapi.com"
29
+ }
30
+
31
+ response = requests.get(url, headers=headers, params=querystring)
32
+
33
+ return response
34
 
35
  @tool
36
  def get_current_time_in_timezone(timezone: str) -> str:
 
58
  temperature=0.5,
59
  model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
60
  custom_role_conversions=None,
61
+ token=os.environ["HF_TOKEN"]
62
  )
63
 
64
 
 
70
 
71
  agent = CodeAgent(
72
  model=model,
73
+ tools=[final_answer, get_current_time_in_timezone, get_football_results], ## add your tools here (don't remove final answer)
74
  max_steps=6,
75
  verbosity_level=1,
76
  grammar=None,