Zaur6100 commited on
Commit
a071f1a
·
verified ·
1 Parent(s): aba3f03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -9,16 +9,21 @@ 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
 
20
-
21
- return "What magic will you build ?"
22
 
23
 
24
  @tool
@@ -60,7 +65,7 @@ with open("prompts.yaml", 'r') as stream:
60
 
61
  agent = CodeAgent(
62
  model=model,
63
- tools=[final_answer, image_generation_tool, search_tool],
64
  max_steps=6,
65
  verbosity_level=1,
66
  grammar=None,
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def text_analyzer_tool(text: str)-> 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
+ """Analyzes a given text to count the number of words and characters.
15
+ This is useful for getting the specific length of a piece of text.
16
  Args:
17
+ text: The string of text that you want to analyze.
 
18
  """
19
+ # Get the number of characters
20
+ num_chars = len(text)
21
+
22
+ # Get the number of words by splitting the text by spaces and counting the parts
23
+ num_words = len(text.split())
24
 
25
+ # Create a clear, descriptive return message for the agent
26
+ return f"The text has {num_chars} characters and {num_words} words."
27
 
28
 
29
  @tool
 
65
 
66
  agent = CodeAgent(
67
  model=model,
68
+ tools=[final_answer, image_generation_tool, search_tool, text_analyzer_tool],
69
  max_steps=6,
70
  verbosity_level=1,
71
  grammar=None,