hardknee commited on
Commit
620cedc
·
verified ·
1 Parent(s): c71539b

Update app.py

Browse files

Another 'None' bug fix attempt

Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -21,13 +21,14 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
21
  @tool
22
  def get_web_search_results(query: 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 searchs the web using a query
25
  Args:
26
- query: A string representing a valid web query (e.g. 'pictures of cats')
 
27
  """
28
  try:
29
  results = DuckDuckGoSearchTool.forward(query)
30
- if results:
31
  return results
32
  else:
33
  return "Your query may be incorrectly formatted. Ensure it is of type str e.g. 'bananas'"
 
21
  @tool
22
  def get_web_search_results(query: 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 searchs the web using a query.
25
  Args:
26
+ query: A string representing a valid web query. IMPORTANT: Follow type str format strictly e.g. 'pictures of cats'.
27
+ Incorrect formatting (such as, query='picture of cats') will result in None being returned.
28
  """
29
  try:
30
  results = DuckDuckGoSearchTool.forward(query)
31
+ if results and results != "None":
32
  return results
33
  else:
34
  return "Your query may be incorrectly formatted. Ensure it is of type str e.g. 'bananas'"