Function Call - Nested Objects in array as parameters

Hi
the following function works with this prompt “Find the location for the following addresses: 123 Main Street, Anytown, Ontario Canada, 456 Second Street, Anytown, Ontario”
(thanks @dlaytonj2 )

functions=[

{
      "name": "get_coordinates",
      "description": "Get the latitude and longitude of multiple mailing addresses",
      "parameters": {
          "type": "object",
          "properties": {
              "addresses": {
                  "type": "array",
                  "description": "The mailing addresses to be located",
                  "items": {
                      "type": "string"
                  }
              }
          },
          "required": ["addresses"]
      }
    }
]

but this function does not
functions =

 {
        "name": "get_weather", 
        "description": "Get weather from given locations and datetimes", 
        "parameters": {
            "type": "object", 
            "properties": {
                "locations": {
                    "type": "array", 
                    "description": "The locations for which to get weather information",
                    "items": {
                        "type": "object",
                        "properties": {
                            "name": { 
                                "type": "string", 
                                "description": "Name of location, e.g. San Francisco, CA" 
                            },
                            "datetime": { 
                                "type": "string", 
                                "description": "Date or time, e.g. today, tomorrow, 2023-06-29" 
                            },
                        }
                    }
                }
            }, 
            "required": ['locations']
        }
 }

I used prompt: “Today What’s the weather like in Boston, and what’s the weather in Houston?”

I get this error : "Error code: 400 - {'error': {'message': "'name' is not of type 'object' - 'functions.0'", 'type': 'invalid_request_error', 'param': None, 'code': None}}
It seems model can’t parse nested objects.
any help would be highly apprecisted. thanks a lot!

When using functions, objects within objects receive no descriptions, even though they are not blocked. They are also not flagged as optional. This means the AI has nothing except the name by which to figure out what they are for.

Your fault, however, seems to be in using a special “name” property incorrectly.

Here is the basic form for a nested function, with the warning of unpassed description:

functions = [
{
    "name": "data_demonstration",
    "description": "This is the main function description",
    "parameters": {
        "type": "object",
        "properties": {
            "object_1": {
                "type": "object",
                "description": "The object data type as a property",
                "properties": {
                "string_2a": {
                    "type": "string",
                    "enum": ["Happy", "Sad"]
                    },
                "string_2b": {
                    "type": "string",
                    "description": "Description in a second object is lost"
                    },
                },
            },
            "string_1": {"type": "string",
                         "description": "Not required gets a question mark"},
        },
        "required": ["object_1","placeholder_2"]
    }
}
]