fabriciojm commited on
Commit
f339384
·
verified ·
1 Parent(s): edad319

added r_counter function

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -18,6 +18,18 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
18
  """
19
  return "What magic will you build ?"
20
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
23
  """A tool that fetches the current local time in a specified timezone.
@@ -57,7 +69,7 @@ with open("prompts.yaml", 'r') as stream:
57
 
58
  agent = CodeAgent(
59
  model=model,
60
- tools=[image_generation_tool, get_current_time_in_timezone, final_answer], ## add your tools here (don't remove final answer)
61
  max_steps=6,
62
  verbosity_level=1,
63
  grammar=None,
 
18
  """
19
  return "What magic will you build ?"
20
 
21
+ def r_counter(arg1:str)-> int: #it's import to specify the return type
22
+ #Keep this format for the description / args / args description but feel free to modify the tool
23
+ """A tool that counts the number of r's in a string
24
+ Args:
25
+ arg1: an input string
26
+ """
27
+ counter = 0
28
+ for c in arg1:
29
+ if c == r:
30
+ counter += 1
31
+ return counter
32
+
33
  @tool
34
  def get_current_time_in_timezone(timezone: str) -> str:
35
  """A tool that fetches the current local time in a specified timezone.
 
69
 
70
  agent = CodeAgent(
71
  model=model,
72
+ tools=[r_counter, image_generation_tool, get_current_time_in_timezone, final_answer], ## add your tools here (don't remove final answer)
73
  max_steps=6,
74
  verbosity_level=1,
75
  grammar=None,