Assistants API / Function Calling / Lazy Formatting / No Retries

I have noticed that occassionally the Assistants API (GPT4 Turbo) will just get lazy and stop respecting the schema identified in the function. It will sometimes change labels (change “startTime” to “start”, for example); or ignore specified date-time formats.

Prompting does not really seem to make a difference (we have used various iteraitons of "strictly adhere, etc.). It works 90% of the time.

This is not usually an issue, as we have implemented error-handling on our function that responds with actionable erros (e.g. “startTime missing. Please resend the request strictly adhereing to the function specification”). And then it fixes it’s mistake and resends a corrected function call. Sometimes this takes 2 or three tries.

But other times… It simply doesn’t rety at all? It just responds to the user that there was an error performing the function.

Anyone else experiencing this, or have tips to cause it to retry?

The fields that ‘change’ - are ALSO listed as REQUIRED?

1 Like

Yes. they are listed as required. here is an example of one used earlier. Sometimes it will send just “start” instead of “startTime”. Sometimes it sends with date alone nad no timezone. And on occasion it has even called it like a python function, instead of providing JSON.

{
  "name": "check_availability",
  "description": "This function checks cruise availability for a specified date range. You must strictly adhere to schema and include startTime and endTime in required formats.",
  "parameters": {
    "type": "object",
    "properties": {
      "startTime": {
        "type": "string",
        "description": "Start date and time (ISO 8601, -04:00 timezone). Format: YYYY-MM-DDT00:00:00-04:00. E.g., '2023-01-14T00:00:00-04:00'.",
        "examples": [
          "2023-01-14T00:00:00-04:00",
          "2024-04-20T00:00:00-04:00"
        ]
      },
      "endTime": {
        "type": "string",
        "description": "End date and time (ISO 8601, -04:00 timezone). Format: YYYY-MM-DDT23:59:59-04:00. E.g., '2023-01-14T23:59:59-04:00'.",
        "examples": [
          "2023-01-14T23:59:59-04:00",
          "2024-04-20T23:59:59-04:00"
        ]
      },
      "adults": {
        "type": "integer",
        "description": "Number of adults (minimum 1).",
        "minimum": 1
      },
      "children": {
        "type": "integer",
        "description": "Number of children (minimum 0).",
        "minimum": 0
      },
      "infants": {
        "type": "integer",
        "description": "Number of infants (minimum 0).",
        "minimum": 0
      }
    },
    "required": [
      "startTime",
      "endTime",
      "adults",
      "children",
      "infants"
    ]
  }
}