Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -294,29 +294,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
294 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
295 |
|
296 |
|
297 |
-
|
298 |
-
@tool
|
299 |
-
def web_search(query: str) -> str:
|
300 |
-
"""Effectue une recherche web DuckDuckGo et retourne les meilleurs résultats.
|
301 |
-
|
302 |
-
Args:
|
303 |
-
query: La requête de recherche à effectuer.
|
304 |
-
"""
|
305 |
-
try:
|
306 |
-
from duckduckgo_search import DDGS
|
307 |
-
ddgs = DDGS()
|
308 |
-
results = ddgs.text(query, max_results=5)
|
309 |
-
|
310 |
-
if len(results) == 0:
|
311 |
-
return "Aucun résultat trouvé. Essayez une requête moins restrictive ou plus courte."
|
312 |
-
|
313 |
-
formatted_results = ["## Résultats de recherche\n"]
|
314 |
-
for result in results:
|
315 |
-
formatted_results.append(f"[{result['title']}]({result['href']})\n{result['body']}\n")
|
316 |
-
|
317 |
-
return "\n".join(formatted_results)
|
318 |
-
except Exception as e:
|
319 |
-
return f"Erreur lors de la recherche: {str(e)}"
|
320 |
|
321 |
final_answer = FinalAnswerTool()
|
322 |
|
@@ -345,8 +323,7 @@ agent = CodeAgent(
|
|
345 |
task_manager,
|
346 |
timer_tool,
|
347 |
inspiration_generator,
|
348 |
-
get_current_time_in_timezone
|
349 |
-
web_search
|
350 |
], ## add your tools here (don't remove final answer)
|
351 |
max_steps=6,
|
352 |
verbosity_level=1,
|
|
|
294 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
295 |
|
296 |
|
297 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
|
299 |
final_answer = FinalAnswerTool()
|
300 |
|
|
|
323 |
task_manager,
|
324 |
timer_tool,
|
325 |
inspiration_generator,
|
326 |
+
get_current_time_in_timezone
|
|
|
327 |
], ## add your tools here (don't remove final answer)
|
328 |
max_steps=6,
|
329 |
verbosity_level=1,
|