Spaces:
Sleeping
Sleeping
fix_wikipediaTool_mst
Browse files
app.py
CHANGED
|
@@ -3,7 +3,6 @@ import datetime
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
-
import wikipedia
|
| 7 |
import math
|
| 8 |
from tools.final_answer import FinalAnswerTool
|
| 9 |
|
|
@@ -52,23 +51,6 @@ def get_time_by_city(city: str) -> str:
|
|
| 52 |
except Exception as e:
|
| 53 |
return f"Error al obtener la hora para '{city}': {str(e)}"
|
| 54 |
|
| 55 |
-
@tool
|
| 56 |
-
def search_wikipedia(query: str) -> str:
|
| 57 |
-
"""Busca información en Wikipedia.
|
| 58 |
-
|
| 59 |
-
Args:
|
| 60 |
-
query: Término de búsqueda (Ejemplo: 'Machine Learning').
|
| 61 |
-
|
| 62 |
-
Returns:
|
| 63 |
-
Resumen del artículo en Wikipedia.
|
| 64 |
-
"""
|
| 65 |
-
try:
|
| 66 |
-
summary = wikipedia.summary(query, sentences=2, lang="es")
|
| 67 |
-
return summary
|
| 68 |
-
except Exception as e:
|
| 69 |
-
return f"Error al buscar en Wikipedia: {str(e)}"
|
| 70 |
-
|
| 71 |
-
|
| 72 |
final_answer = FinalAnswerTool()
|
| 73 |
|
| 74 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
|
@@ -90,7 +72,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 90 |
|
| 91 |
agent = CodeAgent(
|
| 92 |
model=model,
|
| 93 |
-
tools=[calculate_mcm_mcd, get_time_by_city,
|
| 94 |
max_steps=6,
|
| 95 |
verbosity_level=1,
|
| 96 |
grammar=None,
|
|
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
|
|
|
| 6 |
import math
|
| 7 |
from tools.final_answer import FinalAnswerTool
|
| 8 |
|
|
|
|
| 51 |
except Exception as e:
|
| 52 |
return f"Error al obtener la hora para '{city}': {str(e)}"
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
final_answer = FinalAnswerTool()
|
| 55 |
|
| 56 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
|
|
|
| 72 |
|
| 73 |
agent = CodeAgent(
|
| 74 |
model=model,
|
| 75 |
+
tools=[calculate_mcm_mcd, get_time_by_city, final_answer], ## add your tools here (don't remove final answer)
|
| 76 |
max_steps=6,
|
| 77 |
verbosity_level=1,
|
| 78 |
grammar=None,
|