zacpt99 commited on
Commit
34395e5
·
verified ·
1 Parent(s): ae7a494

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -7
app.py CHANGED
@@ -9,14 +9,40 @@ 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 +81,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,
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def make_string_silly(text: str) -> str:
13
+ """A tool that makes text silly by alternating letter case within each word.
14
+ Each word will start with a lowercase letter, followed by alternating uppercase and lowercase letters.
15
+
16
  Args:
17
+ text: The input text string to be made silly
18
+
19
+ Example:
20
+ Input: "Hello World"
21
+ Output: "hElLo wOrLd"
22
  """
23
+ # Split the text into words
24
+ words = text.split()
25
+
26
+ # Process each word
27
+ silly_words = []
28
+ for word in words:
29
+ # Handle empty words or single characters
30
+ if len(word) <= 1:
31
+ silly_words.append(word.lower())
32
+ continue
33
+
34
+ # Convert the word to list of characters for easier manipulation
35
+ chars = list(word.lower()) # Start with all lowercase
36
+
37
+ # Capitalize every other letter starting from index 1
38
+ for i in range(1, len(chars), 2):
39
+ chars[i] = chars[i].upper()
40
+
41
+ # Join the characters back into a word
42
+ silly_words.append(''.join(chars))
43
+
44
+ # Join the words back together with spaces
45
+ return ' '.join(silly_words)
46
 
47
  @tool
48
  def get_current_time_in_timezone(timezone: str) -> str:
 
81
 
82
  agent = CodeAgent(
83
  model=model,
84
+ tools=[final_answer, get_current_time_in_timezone, make_string_silly], ## add your tools here (don't remove final answer)
85
  max_steps=6,
86
  verbosity_level=1,
87
  grammar=None,