exsandebest commited on
Commit
c5c61f9
·
verified ·
1 Parent(s): 9a8c112

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -7
app.py CHANGED
@@ -9,14 +9,34 @@ 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_cutom_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:
@@ -51,7 +71,7 @@ with open("prompts.yaml", 'r') as stream:
51
 
52
  agent = CodeAgent(
53
  model=model,
54
- tools=[final_answer], ## add your tools here (don't remove final answer)
55
  max_steps=6,
56
  verbosity_level=1,
57
  grammar=None,
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def secret_number_guesser(guess: int) -> str:
13
+ """
14
+ A tool that contains a secret number between 0 and 100. It provides hints ('greater than', 'less than', or 'equals to')
15
+ based on the input guess compared to the secret number. The secret number is hidden from the agent.
16
+
17
  Args:
18
+ guess (int): The number guessed by the user, which will be compared to the secret number.
19
+
20
+ Returns:
21
+ str: A hint indicating whether the guess is greater than, less than, or equal to the secret number.
22
+ Returns an error message if the guess is out of bounds or not an integer.
23
  """
24
+ secret_number = 42 # The secret number to guess (hidden from the agent)
25
+
26
+ # Input validation
27
+ if not isinstance(guess, int):
28
+ return "Error: The guess must be an integer."
29
+
30
+ if guess < 0 or guess > 100:
31
+ return "Error: The guess must be between 0 and 100."
32
+
33
+ # Compare the guess to the secret number
34
+ if guess < secret_number:
35
+ return "less than the secret number"
36
+ elif guess > secret_number:
37
+ return "greater than the secret number"
38
+ else:
39
+ return "equals to the secret number"
40
 
41
  @tool
42
  def get_current_time_in_timezone(timezone: str) -> str:
 
71
 
72
  agent = CodeAgent(
73
  model=model,
74
+ tools=[final_answer, secret_number_guesser], ## add your tools here (don't remove final answer)
75
  max_steps=6,
76
  verbosity_level=1,
77
  grammar=None,