https://retellai.com/?utm_source=discord&utm_medium=seo logo
<@1145576664366055464> No pasan los argumentos a m...
# ❓・ai-evy-support
p
@AI Evy No pasan los argumentos a mi custom function
a
Thanks for tagging me @paulo_34072. I'll look through relevant sources and get back to you shortly.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Integrate any system with custom function]() * [Custom Function]() * [Integrate Function Calling]() * [Latest Features (Call Analysis, Backchanneling) And Python Custom LLM Update]() -----------------------------
### Answer Para configurar correctamente una función personalizada, necesitas: 1. Asegurarte que el esquema JSON esté correctamente formateado [(1)]() [(2)]() :
Copy code
javascript
{
  "type": "object",
  "properties": {
    "city": {
      "type": "string",
      "description": "The city of the weather"
    }
  },
  "required": [
    "city"
  ]
}
2. Al recibir la llamada, necesitas acceder a los argumentos a través de
args
en el cuerpo de la solicitud [(3)]() . 3. Para Python, puedes manejar los argumentos así [(2)]() :
Copy code
python
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
from retell import Retell

retell = Retell(api_key=os.environ["RETELL_API_KEY"])

@app.post("/check-weather")
async def check-weather(request: Request):
    try:
        post_data = await request.json()
        args = post_data["args"]
        if args["city"] == "New York":
            return JSONResponse(status_code=200, content={"result": "25f and sunny"})
Un error común es no agregar
"type": "object"
en el nivel superior del esquema JSON [(1)]() [(2)]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
p
@AI Evy Este es mi esquema { "type": "object", "properties": { "id": { "type": "number", "description": "The ID of the user" } }, "required": [ "id" ] } Y no pasa los argumentos Tool Invocation: Get student info tool_call_id: tool_call_b1d63e {} Tool Result tool_call_id: tool_call_b1d63e Axios Error: error code: ERR_BAD_REQUEST, error message: Request failed with status code 400 response status: 400 response data: {"error":"User ID parameter is required"}
a
Thanks for the follow-up, @paulo_34072. I'll get back to you soon.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Integrate Function Calling]() * [LLM WebSocket]() * [Retell Node API Library]() * [Retell Python API library]() -----------------------------
### Answer Para verificar que los argumentos se están pasando correctamente, asegúrate de: 1. Verificar la solicitud entrante. Para Node.js:
Copy code
javascript
this.app.post("/check-weather", async (req: Request, res: Response) => {
  const content = req.body;
  console.log(content.args); // Verifica los argumentos aquí
[(1)]() 2. Para Python:
Copy code
python
@app.post("/check-weather")
async def check-weather(request: Request):
    try:
        post_data = await request.json()
        args = post_data["args"]  # Los argumentos estarán aquí
3. En el prompt del LLM, necesitas instruir explícitamente al agente sobre cómo usar la función con los argumentos [(2)]() . Por ejemplo: "Use the ID mentioned by the customer and call the xyz function with that". Si los argumentos siguen sin pasar, verifica que: - El esquema JSON está correctamente formateado con
"type": "object"
[(1)]() - La descripción del parámetro es clara para el LLM - La función está siendo llamada en el momento correcto dentro del flujo de la conversación [(2)]()
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.