Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,36 +9,14 @@ from Gradio_UI import GradioUI
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
-
def
|
| 13 |
-
|
|
|
|
| 14 |
Args:
|
| 15 |
-
|
|
|
|
| 16 |
"""
|
| 17 |
-
|
| 18 |
-
headers = {"User-Agent": "MiAgenteIA/1.0 (ejecutando desde VSCode)"}
|
| 19 |
-
respuesta = requests.get(url, headers=headers)
|
| 20 |
-
if respuesta.status_code == 200:
|
| 21 |
-
datos = respuesta.json()
|
| 22 |
-
if "blitz" in prompt.lower():
|
| 23 |
-
leaderboard_str = "Leaderboard de Blitz:\n"
|
| 24 |
-
for jugador in datos["live_blitz"][:10]:
|
| 25 |
-
leaderboard_str += f"{jugador['username']} - Rating: {jugador['score']}\n"
|
| 26 |
-
elif "rapid" in prompt.lower():
|
| 27 |
-
leaderboard_str = "Leaderboard de Rapid:\n"
|
| 28 |
-
for jugador in datos["live_rapid"][:10]:
|
| 29 |
-
leaderboard_str += f"{jugador['username']} - Rating: {jugador['score']}\n"
|
| 30 |
-
elif "daily" in prompt.lower():
|
| 31 |
-
leaderboard_str = "Leaderboard diario:\n"
|
| 32 |
-
for jugador in datos["daily"][:10]:
|
| 33 |
-
leaderboard_str += f"{jugador['username']} - Rating: {jugador['score']}\n"
|
| 34 |
-
else:
|
| 35 |
-
leaderboard_str = "Leaderboard de Blitz:\n"
|
| 36 |
-
for jugador in datos["live_blitz"][:10]:
|
| 37 |
-
leaderboard_str += f"{jugador['username']} - Rating: {jugador['score']}\n"
|
| 38 |
-
return leaderboard_str
|
| 39 |
-
else:
|
| 40 |
-
return f"Error al obtener datos: {respuesta.status_code}"
|
| 41 |
-
|
| 42 |
|
| 43 |
@tool
|
| 44 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -77,7 +55,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 77 |
|
| 78 |
agent = CodeAgent(
|
| 79 |
model=model,
|
| 80 |
-
tools=[final_answer
|
| 81 |
max_steps=6,
|
| 82 |
verbosity_level=1,
|
| 83 |
grammar=None,
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
| 13 |
+
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
+
"""A tool that does nothing yet
|
| 15 |
Args:
|
| 16 |
+
arg1: the first argument
|
| 17 |
+
arg2: the second argument
|
| 18 |
"""
|
| 19 |
+
return "What magic will you build ?"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
+
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|