If you have a “parameters” property within your function schema, it will cause the function arguments submitted to wrap additional properties within the “parameters” property.
Example Assistant Function:
{
"name": "QuerySales",
"parameters": {
"additionalProperties": false,
"properties": {
"parameters": {
"type": "object",
"additionalProperties": false,
"description": "The query parameters.",
"properties": {
"type": {
"type": "object",
"additionalProperties": false,
"description": "The type of query to be performed, with possible date interval.",
"properties": {
"name": {
"description": "The type name of the query to be performed.",
"type": "string",
"examples": [
"metric"
],
"enum": [
"metric",
"timeline",
"grouped"
]
}
},
"required": [
"name"
]
},
"analytic": {
"description": "The specified column and aggregate to be performed.",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"column": {
"description": "The column to select for performing the aggregate function on.",
"type": "string",
"examples": [
"amount"
],
"enum": [
"amount"
]
},
"aggregate": {
"description": "The aggregate function to perform on the column.",
"type": "string",
"examples": [
"sum"
],
"enum": [
"count",
"sum"
]
}
},
"required": [
"column",
"aggregate"
]
}
}
},
"required": [
"type",
"analytic"
]
},
"filters": {
"type": "object",
"additionalProperties": false,
"description": "Filters to apply to the query.",
"properties": {
"date_start": {
"description": "The start date for the query date range.",
"type": "string",
"format": "date-time",
"examples": [
"2021-08-03T00:00:00-04:00"
]
},
"date_end": {
"description": "The end date for the query date range.",
"type": "string",
"format": "date-time",
"examples": [
"2021-10-03T23:59:59-04:00"
]
}
},
"required": [
"date_start",
"date_end"
]
}
},
"type": "object",
"required": [
"parameters",
"filters"
]
},
"description": "Perform a sales query."
}
OpenAI outputs Function arguments. Notice how “filters” was placed in “parameters”.
{
"parameters": {
"type": {
"name": "metric"
},
"analytic": [
{
"column": "amount_gross",
"aggregate": "sum"
}
],
"filters": {
"date_start": "2023-10-01T00:00:00Z",
"date_end": "2023-10-31T23:59:59Z"
}
}
}
If you change “parameters” property to something else, like “settings” it will output properly.
TLDR: The schema parser for assistant functions seems to wrap any “parameters” property within the schema itself as if it were the functions’ parameters. Hope this made sense.