Files changed (1) hide show
  1. app.py +31 -6
app.py CHANGED
@@ -6,17 +6,42 @@ import yaml
6
  from tools.final_answer import FinalAnswerTool
7
 
8
  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_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:
@@ -55,7 +80,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,
 
6
  from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
9
+ import random
10
+ import string
11
 
12
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
13
  @tool
14
+ def generate_password(first_name:str, last_name:str, length: int = 16)-> str: #it's import to specify the return type
15
  #Keep this format for the description / args / args description but feel free to modify the tool
16
+ """Generates a strong password using parts of user's first name and last name with
17
+ added randomness
18
  Args:
19
+ first_name: User's first name
20
+ last_name: User's last name
21
+ length: Desired length of the password (default: 16)
22
+ return: A generated strong password string
23
  """
24
+ if not first_name or not last_name:
25
+ raise ValueError("First and last name cannot be empty")
26
+
27
+ # Extract and mix parts of names
28
+ first_part = first_name[:3] if len(first_name) >= 3 else first_name
29
+ last_part = last_name[:3] if len(last_name) >= 3 elst last_name
30
+
31
+ # Ensure password contains a mix of character types
32
+ special_characters = ['!', '@', '#', '&', '%', '~']
33
+ special_char = random.choice(special_characters)
34
+
35
+ # generate additional random characters
36
+ random_chars = ''.join(random.choices(string.ascii_letters + string.digits + string.punctuation,
37
+ k=length - len(first_part) - len(last_part) - 4))
38
+
39
+ # combine all parts
40
+ password = first_part + last_part + random_chars + special_char
41
+
42
+ # shuffle password to increase security
43
+ password = ''.join(random.sample(password, len(password)))
44
+ return password
45
 
46
  @tool
47
  def get_current_time_in_timezone(timezone: str) -> str:
 
80
 
81
  agent = CodeAgent(
82
  model=model,
83
+ tools=[final_answer, generate_password, image_generation_tool], ## add your tools here (don't remove final answer)
84
  max_steps=6,
85
  verbosity_level=1,
86
  grammar=None,