Spaces:
Sleeping
Sleeping
update
#3
by
x0pr4nt3s
- opened
app.py
CHANGED
|
@@ -7,13 +7,19 @@ def get_weather(city: str) -> str:
|
|
| 7 |
print("Llamada a la funcion!")
|
| 8 |
return f"El clima en {city} es diferente!"
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
agent = Agent(
|
| 11 |
name="Agente del clima",
|
| 12 |
instructions="Responde como reportero del clima, siempre usa tus herramientas.",
|
| 13 |
model="gpt-4.1-mini",
|
| 14 |
-
tools=[get_weather],
|
| 15 |
)
|
| 16 |
|
|
|
|
| 17 |
# Función asíncrona
|
| 18 |
async def chat_fn(user_message, history):
|
| 19 |
context = {"history": history}
|
|
|
|
| 7 |
print("Llamada a la funcion!")
|
| 8 |
return f"El clima en {city} es diferente!"
|
| 9 |
|
| 10 |
+
@function_tool
|
| 11 |
+
def get_sum(sum: str) ->str:
|
| 12 |
+
print("Se llamo a la funcion 2")
|
| 13 |
+
return str(5+3)
|
| 14 |
+
|
| 15 |
agent = Agent(
|
| 16 |
name="Agente del clima",
|
| 17 |
instructions="Responde como reportero del clima, siempre usa tus herramientas.",
|
| 18 |
model="gpt-4.1-mini",
|
| 19 |
+
tools=[get_weather, get_sum],
|
| 20 |
)
|
| 21 |
|
| 22 |
+
|
| 23 |
# Función asíncrona
|
| 24 |
async def chat_fn(user_message, history):
|
| 25 |
context = {"history": history}
|