Ongota commited on
Commit
d010d5f
·
verified ·
1 Parent(s): ae7a494

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -3,6 +3,7 @@ import datetime
3
  import requests
4
  import pytz
5
  import yaml
 
6
  from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
@@ -18,6 +19,20 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
18
  """
19
  return "What magic will you build ?"
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
23
  """A tool that fetches the current local time in a specified timezone.
@@ -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,
 
3
  import requests
4
  import pytz
5
  import yaml
6
+ import math
7
  from tools.final_answer import FinalAnswerTool
8
 
9
  from Gradio_UI import GradioUI
 
19
  """
20
  return "What magic will you build ?"
21
 
22
+ @tool
23
+ def get_length_of_hypothenuse(arg1:float, arg2:float)-> str: #it's import to specify the return type
24
+ #Keep this format for the description / args / args description but feel free to modify the tool
25
+ """A tool that calculates the length of the hypothenuse of a right angle triangle.
26
+ Args:
27
+ arg1: a float representing the length of the base of the triangle
28
+ arg2: a float representing the height of the triangle
29
+ """
30
+ try:
31
+ h = math.sqrt(arg1*arg1 + arg2*arg2)
32
+ return f"The length of the hypothenuse is {h}"
33
+ except Exception as e:
34
+ return f"Error calculating hypothenuse for a triangle with base {arg1} and height {arg2}: {str(e)}"
35
+
36
  @tool
37
  def get_current_time_in_timezone(timezone: str) -> str:
38
  """A tool that fetches the current local time in a specified timezone.
 
70
 
71
  agent = CodeAgent(
72
  model=model,
73
+ tools=[get_length_of_hypothenuse, get_current_time_in_timezone, final_answer], ## add your tools here (don't remove final answer)
74
  max_steps=6,
75
  verbosity_level=1,
76
  grammar=None,