BettoEsteves commited on
Commit
c053a04
·
verified ·
1 Parent(s): 8ae2320

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -36,21 +36,24 @@ def get_current_time_in_timezone(timezone: str) -> str:
36
  @tool
37
  def research_assistant(question: str) -> str:
38
  """Ferramenta de pesquisa na web e geração de conteúdo.
39
-
40
  Args:
41
- question (str): pergunta para a pesquisa
 
42
  Returns:
43
  str: Resultados da pesquisa com imagem
44
  """
45
- search_results = DuckDuckGoSearchTool().run(question)
46
-
47
- image_url = image_generation_tool(f"Infográfico sobre: {question[ :50]}...")
48
-
49
- return f"""-> Resultados da pesquisa:
50
  {search_results}
51
 
52
  Visualização:
53
  {image_url}"""
 
 
 
54
 
55
 
56
  final_answer = FinalAnswerTool()
 
36
  @tool
37
  def research_assistant(question: str) -> str:
38
  """Ferramenta de pesquisa na web e geração de conteúdo.
 
39
  Args:
40
+ question (str): pergunta para a pesquisa. [Quais restaurantes famosos tem na região?]
41
+
42
  Returns:
43
  str: Resultados da pesquisa com imagem
44
  """
45
+ try:
46
+ search_results = DuckDuckGoSearchTool().run(question)
47
+ image_url = image_generation_tool(f"Imagem: {question[ :50]}...")
48
+ return f"""-> Resultados da pesquisa '{question}':
49
+
50
  {search_results}
51
 
52
  Visualização:
53
  {image_url}"""
54
+ except Exception as e:
55
+ return f"Erro na pesquisa: {str(e)}"
56
+
57
 
58
 
59
  final_answer = FinalAnswerTool()