Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ class WebSearchTool:
|
|
| 10 |
"""Outil qui permet de faire une recherche sur un site web donné en utilisant DuckDuckGo."""
|
| 11 |
|
| 12 |
def __init__(self):
|
| 13 |
-
self.duckduckgo_search_tool = load_tool("smolagents:DuckDuckGoSearchTool")
|
| 14 |
|
| 15 |
def search(self, query: str, max_results: int = 5) -> List[str]:
|
| 16 |
"""Effectue une recherche sur DuckDuckGo et retourne les résultats limités à `max_results`.
|
|
@@ -28,18 +28,7 @@ class WebSearchTool:
|
|
| 28 |
|
| 29 |
return [result['snippet'] for result in results]
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
|
| 33 |
-
@tool
|
| 34 |
-
def my_custom_tool(arg1: str, arg2: int) -> str:
|
| 35 |
-
"""A tool that does nothing yet
|
| 36 |
-
Args:
|
| 37 |
-
arg1: the first argument
|
| 38 |
-
arg2: the second argument
|
| 39 |
-
"""
|
| 40 |
-
return "What magic will you build ?"
|
| 41 |
-
|
| 42 |
-
# Ajoutons une description détaillée pour l'argument 'timezone'
|
| 43 |
@tool
|
| 44 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 45 |
"""Récupère le temps local actuel dans un fuseau horaire spécifié.
|
|
@@ -62,6 +51,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 62 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 63 |
|
| 64 |
final_answer = FinalAnswerTool()
|
|
|
|
| 65 |
model = HfApiModel(
|
| 66 |
max_tokens=2096,
|
| 67 |
temperature=0.5,
|
|
@@ -69,7 +59,7 @@ model = HfApiModel(
|
|
| 69 |
custom_role_conversions=None,
|
| 70 |
)
|
| 71 |
|
| 72 |
-
#
|
| 73 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 74 |
|
| 75 |
with open("prompts.yaml", 'r') as stream:
|
|
|
|
| 10 |
"""Outil qui permet de faire une recherche sur un site web donné en utilisant DuckDuckGo."""
|
| 11 |
|
| 12 |
def __init__(self):
|
| 13 |
+
self.duckduckgo_search_tool = load_tool("smolagents:DuckDuckGoSearchTool", trust_remote_code=True)
|
| 14 |
|
| 15 |
def search(self, query: str, max_results: int = 5) -> List[str]:
|
| 16 |
"""Effectue une recherche sur DuckDuckGo et retourne les résultats limités à `max_results`.
|
|
|
|
| 28 |
|
| 29 |
return [result['snippet'] for result in results]
|
| 30 |
|
| 31 |
+
# Maintenons une docstring détaillée pour `get_current_time_in_timezone`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
@tool
|
| 33 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 34 |
"""Récupère le temps local actuel dans un fuseau horaire spécifié.
|
|
|
|
| 51 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 52 |
|
| 53 |
final_answer = FinalAnswerTool()
|
| 54 |
+
|
| 55 |
model = HfApiModel(
|
| 56 |
max_tokens=2096,
|
| 57 |
temperature=0.5,
|
|
|
|
| 59 |
custom_role_conversions=None,
|
| 60 |
)
|
| 61 |
|
| 62 |
+
# Importer l'outil d'image avec confiance
|
| 63 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 64 |
|
| 65 |
with open("prompts.yaml", 'r') as stream:
|