makinuh commited on
Commit
448f35e
·
verified ·
1 Parent(s): b7d6608

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -13
app.py CHANGED
@@ -9,19 +9,20 @@ 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 queries a search engine such that the response has the exact number of user-specified entries.
15
- Args:
16
- arg1: A string representing a search engine query
17
- arg2: A float representing the requested number of search engine responses
18
- """
19
- try:
20
- # Create arg1 object
21
- # query =
22
- # Create arg2 object
23
- # query =
24
- return "What magic will you build ?"
 
25
 
26
  @tool
27
  def get_current_time_in_timezone(timezone: str) -> str:
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def limited_search(self, search_query: str, num_results: int) -> str:
13
+ """
14
+ Performs a DuckDuckGo search with the number of search results specified in initial user input.
15
+
16
+ Args:
17
+ search_query: The string search query.
18
+ num_results: An integer representing the requested number of search engine responses.
19
+
20
+ Returns:
21
+ str: A string containing the search results.
22
+ """
23
+ search_tool = DuckDuckGoSearchTool()
24
+ results = search_tool.use(query=search_query, max_results=num_results)
25
+ return str(results)
26
 
27
  @tool
28
  def get_current_time_in_timezone(timezone: str) -> str: