Learner commited on
Commit
ed64da2
·
verified ·
1 Parent(s): c21cbb9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -9
app.py CHANGED
@@ -9,17 +9,27 @@ 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 get_family_age(my_family:str)-> dict[str, dict[str, int]]:
13
- """A tool that looks up family ages and returns a dict with family: age value pairs. {my_family: {"father": 60}, {"mother": 50}}
 
14
  Args:
15
- my_family: A string representing a the family type to retrieve the age for
 
 
16
  """
17
- father = 60
18
- mother = 61
19
- sister = 40
20
- brother = 42
21
- dog = 17
22
- return my_family_dict
 
 
 
 
 
 
 
23
 
24
  @tool
25
  def get_current_time_in_timezone(timezone: str) -> str:
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def get_family_age(my_family: str) -> str:
13
+ """A tool that looks up family ages and returns a formatted string with the family member's age.
14
+
15
  Args:
16
+ my_family: A string representing the family member type to retrieve the age for (e.g., 'father', 'mother')
17
+ Returns:
18
+ A string with the family member's age
19
  """
20
+ my_family_age = {
21
+ "father": 60,
22
+ "mother": 61,
23
+ "sister": 40,
24
+ "brother": 42,
25
+ "dog": 17
26
+ }
27
+
28
+ if my_family.lower() in my_family_age:
29
+ age = my_family_age[my_family.lower()]
30
+ return f"my {my_family} is {age} years old"
31
+ else:
32
+ return f"Family member '{my_family}' not found"
33
 
34
  @tool
35
  def get_current_time_in_timezone(timezone: str) -> str: