schatt commited on
Commit
e669587
·
verified ·
1 Parent(s): 045a21b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -19,22 +19,23 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
19
  return "What magic will you build ?"
20
 
21
  @tool
22
- def my_wiki_tool(arg1:str)-> str: #it's import to specify the return type
23
- #Keep this format for the description / args / args description but feel free to modify the tool
24
- """A tool that fetches the relevent information for wikipedia only
25
  Args:
26
- arg1: A string provides the details what needs to be searched in wikipedia
27
  """
 
28
  duckduckgo_tool = DuckDuckGoSearchTool()
29
 
30
- # You can now use it to search for any of the topics above
31
- search_results = duckduckgo_tool.search(arg1)
32
- result_str = "" # Initialize an empty string to accumulate the results
 
33
 
34
  for result in search_results:
35
- # Add each 'Text' value from the result to the result_str
36
  result_str += result.get('Text', '') + '\n' # Adding a newline for each result
37
-
38
  return result_str
39
 
40
  @tool
 
19
  return "What magic will you build ?"
20
 
21
  @tool
22
+ def my_wiki_tool(arg1: str) -> str: # It's important to specify the return type
23
+ """A tool that fetches the relevant information for Wikipedia only
 
24
  Args:
25
+ arg1: A string that provides the details of what needs to be searched on Wikipedia.
26
  """
27
+ # Initialize DuckDuckGo search tool
28
  duckduckgo_tool = DuckDuckGoSearchTool()
29
 
30
+ # Use DuckDuckGo search tool to search for the query
31
+ search_results = duckduckgo_tool.search(arg1)
32
+
33
+ result_str = "" # Initialize an empty string to accumulate the results
34
 
35
  for result in search_results:
36
+ # Add each 'Text' value from the result to result_str
37
  result_str += result.get('Text', '') + '\n' # Adding a newline for each result
38
+
39
  return result_str
40
 
41
  @tool