https://retellai.com/?utm_source=discord&utm_medium=seo logo
Problem with argument extraction
# ❓・bug-report
c
@AI Evy I'm experiencing an issue with a Custom Function designed to extract check_in_date and check_out_date from user conversation (in Spanish). The function is correctly invoked after the user provides the dates, and the webhook receives the call. However, the arguments object in the received payload is consistently empty ({}). 1.The function is being called at the appropriate time. 2.The arguments object is always empty ({}). 3.This happens even when the user clearly states both dates, including the year. 4.The JSON defining the function is valid (checked via validator) and uses required for both parameters. 5.I've tried different LLMs and added detailed descriptions with examples to the JSON parameters. 6.A similar setup used to work yesterday. Is this a known issue, a potential bug , or is there something else I might be missing?
a
Thanks for tagging me @chezar89. 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**: * [Custom Function]() * [Integrate any system with custom function]() * [Integrate Function Calling]() * [Discord message from @fyodor2572 on 2024-10-26]() -----------------------------
### Answer Based on the available documentation, here are a few key points to check: 1. Ensure your function parameters are properly defined using the JSON schema format [(1)]() . The schema should include
"type": "object"
at the top level to avoid validation errors . 2. Make sure your prompt explicitly instructs when to invoke the custom function . For example:
Copy code
When user provided the city name, please get the weather for that city by calling the `get_weather` function.
3. Verify that the arguments are properly structured in the
args
field of the request body [(2)]() . Custom functions in Retell always use POST method and send arguments within an 'args' object in the JSON payload . 4. For date-related parameters, ensure the date format matches exactly what's specified in your schema [(3)]() . If using dynamic variables, verify they are being properly passed to the function and not being overridden . 5. Within your tools/prompt, you should specify how to pass the parameters and instruct the agent to use the information mentioned by the customer [(4)]() . If the issue persists after checking these points, you may want to verify the request payload being sent to your endpoint by logging it, as there could be discrepancies in how the parameters are being processed [(3)]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy Thanks for the checklist. I've already confirmed all these points: My JSON schema is valid and correctly structured. The function description clearly instructs when to call it. I am logging the payload and can confirm the args/arguments object is received, but it's empty ({}). I've tested with various date formats and LLMs Given this, the standard checks don't seem to apply. Could this be a bug or a regression, potentially related to Spanish date extraction or recent platform updates?
a
Appreciate the feedback! Feel free to ask me again with additional guidance or context.
c
@AI Evy Thanks for the checklist. I've already confirmed all these points: My JSON schema is valid and correctly structured. The function description clearly instructs when to call it. I am logging the payload and can confirm the args/arguments object is received, but it's empty ({}). I've tested with various date formats and LLMs Given this, the standard checks don't seem to apply. Could this be a bug or a regression, potentially related to Spanish date extraction or recent platform updates?
a
Thanks for the follow-up, @chezar89. I'll get back to you soon.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Custom Function]() * [Integrate any system with custom function]() * [Integrate Function Calling]() * [Platform Changelogs | Retell AI]() -----------------------------
### Answer Based on recent similar issues documented, there might be a potential issue with dynamic variables processing in custom functions. A similar issue was reported where dynamic variables were not being properly processed in the payload [(1)]() . For troubleshooting, verify that your date format strictly matches 'YYYY-MM-DDTHH:MM:SSZ' with the 'Z' indicating UTC time . You can also check the following: 1. Verify the request using the
X-Retell-Signature
header to ensure the request is properly coming from Retell [(2)]() . 2. Monitor the function call results in your transcripts, as Retell has recently added function call tracking capabilities [(3)]() . If the issue persists, you can: 1. Log the complete request body, not just the args, as the call object contains real-time transcript up to when the request is sent [(2)]() . 2. Check if the function timeout (default 2 minutes) is being reached, as requests will be retried up to 2 times if they fail . For additional support or to report a potential bug, I recommend checking out [Contact Sales]() or [https://github.com/RetellAI/](). Would you like me to provide a general answer about function calling implementation?
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Appreciate the feedback! Feel free to ask me again with additional guidance or context.
c
@AI Evy El siguiente json es correcto? Cuando lo envío a make.com, la parte de arguments está vacía: { "name": "test_final_fechas_simple", "description": "TEST FINAL: Extrae check-in y check-out si el usuario los dice claramente con año.", "parameters": { "type": "object", "properties": { "fecha_entrada": { "type": "string", "description": "La fecha de check-in." }, "fecha_salida": { "type": "string", "description": "La fecha de check-out." } }, "required": [ "fecha_entrada", "fecha_salida" ] } }
a
Thanks for the follow-up, @chezar89. I'll get back to you soon.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Integrate any system with custom function]() * [Custom Function]() * [Discord message from @neoxsaibot on 2024-11-04]() * [custom function Error with VALID JSON Schema]() -----------------------------
### Answer El JSON schema es sintácticamente correcto, pero hay algunos puntos importantes a considerar: 1. Asegúrate de que el schema incluya
"type": "object"
en el nivel superior [(1)]() 2. Para verificar que la solicitud está llegando correctamente desde Retell, debes revisar el encabezado
X-Retell-Signature
[(2)]() 3. Los argumentos se envían en el cuerpo de la solicitud bajo la propiedad
args
[(2)]() [(3)]() Aquí tienes un ejemplo de schema validado:
Copy code
javascript
{
  "type": "object",
  "properties": {
    "fecha_entrada": {
      "type": "string",
      "description": "La fecha de check-in."
    },
    "fecha_salida": {
      "type": "string",
      "description": "La fecha de check-out."
    }
  },
  "required": [
    "fecha_entrada",
    "fecha_salida"
  ]
}
[(4)]() También asegúrate de: 1. Incluir instrucciones explícitas en el prompt sobre cuándo invocar la función 2. Verificar que la respuesta tenga un código de estado entre 200-299 [(2)]() Si el problema persiste después de estos ajustes, ¿te gustaría que te proporcionara una respuesta general sobre la implementación de funciones personalizadas?
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy Could you give me a full json like the one that I sent you but with the necesary corrections?
a
Thanks for the follow-up, @chezar89. I'll get back to you soon.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Integrate Function Calling]() * [Integrate any system with custom function]() * [Custom Function]() * [How to pass in variables in the General Tool / State Tool function calls?]() -----------------------------
### Answer Here's the corrected JSON schema:
Copy code
javascript
{
  "type": "object",
  "properties": {
    "name": "test_final_fechas_simple",
    "description": "TEST FINAL: Extrae check-in y check-out si el usuario los dice claramente con año.",
    "function": {
      "type": "object",
      "properties": {
        "fecha_entrada": {
          "type": "string",
          "description": "La fecha de check-in en formato YYYY-MM-DD."
        },
        "fecha_salida": {
          "type": "string", 
          "description": "La fecha de check-out en formato YYYY-MM-DD."
        }
      },
      "required": [
        "fecha_entrada",
        "fecha_salida"
      ]
    }
  }
}
[(1)]() [(2)]() Key changes made: 1. Added
"type": "object"
at the root level 2. Structured the function definition under a
function
property 3. Added format specification in the description 4. Maintained the required fields array When this function is called, Retell will send a POST request to your endpoint with the arguments in the
args
object of the request body [(3)]() . Make sure your webhook endpoint is configured to handle POST requests, as Retell custom functions always use POST method . Would you like me to provide additional details about how to handle the response or verify the requests?
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.