techarmour commited on
Commit
d03a4d0
·
verified ·
1 Parent(s): b979222

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -11
app.py CHANGED
@@ -12,10 +12,19 @@ from Gradio_UI import GradioUI
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
- """A tool that search and add prefix and appendix with "#"
 
 
 
 
 
 
16
  Args:
17
- arg1: the first argument
18
- arg2: the second argument
 
 
 
19
  """
20
 
21
  # Instantiate the duck_tool
@@ -24,18 +33,19 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
24
  # Define your search query
25
  query = arg1
26
  count = arg2
27
- appendix = ""
28
- prefix = ""
 
 
 
29
 
30
  # Use the .run() method to perform the search
31
- for count > 0
32
- appendix = appendix + "#"
33
- prefix = "#" + prefix
34
-
35
- search_results = appendix + duck_tool.run(query) + appendix
36
 
37
  #return "What magic will you build ?"
38
- return search_results
 
 
39
 
40
 
41
  @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
+ """A tool that searches using DuckDuckGoSearchTool and adds a prefix and an appendix consisting of '#' characters.
21
+
22
  Args:
23
+ arg1 (str): The search query.
24
+ arg2 (int): The number of '#' characters to add as prefix and appendix.
25
+
26
+ Returns:
27
+ str: The search results wrapped with the '#' prefix and appendix.
28
  """
29
 
30
  # Instantiate the duck_tool
 
33
  # Define your search query
34
  query = arg1
35
  count = arg2
36
+
37
+
38
+ # Create the prefix and appendix by repeating '#' count times
39
+ prefix = "#" * count
40
+ appendix = "#" * count
41
 
42
  # Use the .run() method to perform the search
43
+ search_results = duck_tool.run(query)
 
 
 
 
44
 
45
  #return "What magic will you build ?"
46
+
47
+ # Return the search results with the prefix and appendix added
48
+ return prefix + search_results + appendix
49
 
50
 
51
  @tool