cocolook commited on
Commit
b8fe276
·
verified ·
1 Parent(s): ef3b735

Update app.py

Browse files

add another tool

Files changed (1) hide show
  1. app.py +24 -6
app.py CHANGED
@@ -10,14 +10,32 @@ from Gradio_UI import GradioUI
10
 
11
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
12
  @tool
13
- def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
14
- #Keep this format for the description / args / args description but feel free to modify the tool
15
- """A tool that does nothing yet
 
 
 
 
16
  Args:
17
- arg1: the first argument
18
- arg2: the second argument
 
 
19
  """
20
- return "What magic will you build ?"
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  @tool
23
  def get_a_joke(keyword: str = None) -> str:
 
10
 
11
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
12
  @tool
13
+ def get_chinese_zodiac_sign(year: int = None) -> str:
14
+ """
15
+ A tool that translates a Gregorian year into its corresponding Chinese Zodiac animal sign.
16
+
17
+ The Chinese Zodiac cycle is based on a 12-year cycle, with each year
18
+ assigned to an animal. The cycle starts with the Rat.
19
+
20
  Args:
21
+ year (int): The Gregorian calendar year (e.g., 1997, 2025).
22
+
23
+ Returns:
24
+ str: The name of the Chinese Zodiac animal sign.
25
  """
26
+
27
+ # 1. List of 12 animals in order, starting with Rat
28
+ zodiac_signs = [
29
+ "Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake",
30
+ "Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig"
31
+ ]
32
+
33
+ # 2. Calculate the index: 1900 was the year of the Rat (index 0).
34
+ # The modulo 12 operation ensures the index wraps around correctly.
35
+ index = (year - 1900) % 12
36
+
37
+ # 3. Return the animal sign at the calculated index
38
+ return zodiac_signs[index]
39
 
40
  @tool
41
  def get_a_joke(keyword: str = None) -> str: