Shenkezs commited on
Commit
0bcd6cd
·
verified ·
1 Parent(s): 8c5c24b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -11,13 +11,27 @@ from Gradio_UI import GradioUI
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:
23
  """A tool that fetches the current local time in a specified timezone.
 
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 converts temperature
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 calculate_discount_tool(product_name: str, discount_percent: int) -> str:
23
+ """A tool that calculates the discount on a product
24
+ Args:
25
+ product_name: name of the product
26
+ discount_percent: discount to apply in percentage
27
+ """
28
+ original_price = 100 # For simplicity, assume every product starts at ₦100
29
+ discount_amount = (discount_percent / 100) * original_price
30
+ new_price = original_price - discount_amount
31
+
32
+ return f"The product '{product_name}' has a {discount_percent}% discount. New price is ₦{new_price:.2f}."
33
+
34
+
35
  @tool
36
  def get_current_time_in_timezone(timezone: str) -> str:
37
  """A tool that fetches the current local time in a specified timezone.