Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,7 @@ from Gradio_UI import GradioUI
|
|
| 7 |
duckduckgo_tool = DuckDuckGoSearchTool()
|
| 8 |
|
| 9 |
# 2. Define Custom Tool
|
|
|
|
| 10 |
@tool
|
| 11 |
def get_composer_lifespan_from_web(composer_lastname: str) -> str:
|
| 12 |
"""
|
|
@@ -15,11 +16,16 @@ def get_composer_lifespan_from_web(composer_lastname: str) -> str:
|
|
| 15 |
Args:
|
| 16 |
composer_lastname: El apellido del compositor (p. ej., 'Beethoven', 'Mozart').
|
| 17 |
"""
|
| 18 |
-
|
| 19 |
-
query = f"classical composer {composer_lastname} full name birth and death year"
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
return f"""
|
| 25 |
RESULTADOS DE BÚSQUEDA:
|
|
|
|
| 7 |
duckduckgo_tool = DuckDuckGoSearchTool()
|
| 8 |
|
| 9 |
# 2. Define Custom Tool
|
| 10 |
+
# --- Herramientas personalizadas (Solo queda la de compositores) ---
|
| 11 |
@tool
|
| 12 |
def get_composer_lifespan_from_web(composer_lastname: str) -> str:
|
| 13 |
"""
|
|
|
|
| 16 |
Args:
|
| 17 |
composer_lastname: El apellido del compositor (p. ej., 'Beethoven', 'Mozart').
|
| 18 |
"""
|
| 19 |
+
global duckduckgo_tool
|
|
|
|
| 20 |
|
| 21 |
+
# CRITICAL CHANGE: Use a shorter, less restrictive query.
|
| 22 |
+
# The original was: "classical composer {composer_lastname} full name birth and death year"
|
| 23 |
+
# The new one is simply the composer's name.
|
| 24 |
+
query = f"{composer_lastname} composer lifespan"
|
| 25 |
+
|
| 26 |
+
# Use .forward() instead of the direct call if available, or just the direct call
|
| 27 |
+
# depending on the smolagents version. Assuming .forward() from the previous correction.
|
| 28 |
+
search_result = duckduckgo_tool.forward(query)
|
| 29 |
|
| 30 |
return f"""
|
| 31 |
RESULTADOS DE BÚSQUEDA:
|