Sarah commited on
Commit
71ec7d7
·
verified ·
1 Parent(s): 22f8707

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -29,9 +29,13 @@ def search_answer(question: str) -> str:
29
  Returns:
30
  str: A summarized text extracted from DuckDuckGo search results.
31
  """
32
- search_tool = DuckDuckgoSearchTool()
33
- results = search_tool(question)
34
- return results
 
 
 
 
35
 
36
  @tool
37
  def get_current_time_in_timezone(timezone: str) -> str:
 
29
  Returns:
30
  str: A summarized text extracted from DuckDuckGo search results.
31
  """
32
+ try:
33
+ search_tool = DuckDuckgoSearchTool()
34
+ results = search_tool(question)
35
+ return results or "No relevant results were found."
36
+ except Exception as e:
37
+ logger.error(f"DuckDuckGo search failed: {e}")
38
+ return "Sorry, I couldn't complete the search due to an internal error."
39
 
40
  @tool
41
  def get_current_time_in_timezone(timezone: str) -> str: