Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,16 @@
|
|
| 1 |
-
from agents import Agent, Runner, Tool # Llama al SDK de agentes
|
| 2 |
import gradio as gr
|
| 3 |
import os
|
| 4 |
from datetime import datetime
|
| 5 |
|
| 6 |
# 2. Define la primera herramienta: devuelve la hora actual
|
|
|
|
| 7 |
def get_time():
|
| 8 |
print("Llamando a la hora")
|
| 9 |
return {"time": datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
|
| 10 |
|
| 11 |
# 3. Define la segunda herramienta: suma dos números
|
|
|
|
| 12 |
def add(a: float, b: float):
|
| 13 |
print("Llamando a la suma")
|
| 14 |
return {"result": a + b}
|
|
|
|
| 1 |
+
from agents import Agent, Runner, Tool, function_tool # Llama al SDK de agentes
|
| 2 |
import gradio as gr
|
| 3 |
import os
|
| 4 |
from datetime import datetime
|
| 5 |
|
| 6 |
# 2. Define la primera herramienta: devuelve la hora actual
|
| 7 |
+
@function_tool
|
| 8 |
def get_time():
|
| 9 |
print("Llamando a la hora")
|
| 10 |
return {"time": datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
|
| 11 |
|
| 12 |
# 3. Define la segunda herramienta: suma dos números
|
| 13 |
+
@function_tool
|
| 14 |
def add(a: float, b: float):
|
| 15 |
print("Llamando a la suma")
|
| 16 |
return {"result": a + b}
|