I’m trying to get it to generate valid Vega-Lite chart definitions using the new Structured Outputs JSON Schema. If I feed it the JSON Schema directly from the schema they provide, it complains:
Invalid schema for response_format ‘Vega-Lite’: schema must be a JSON Schema of ‘type: "object"’, got ‘type: "None"’.
This is easy to fix, I just injected "type": "object"
in the root of the schema.
After that, it gives a different error:
Invalid schema for response_format ‘Vega-Lite’: In context=(), ‘required’ is required to be supplied and to be an array including every key in properties. Missing ‘groupby’
The part its complaining about happens early in the schema:
"AggregateTransform": {
"additionalProperties": false,
"properties": {
"aggregate": {
"description": "Array of objects that define fields to aggregate.",
"items": {"$ref": "#/definitions/AggregatedFieldDef"},
"type": "array"
},
"groupby": {
"description": "The data fields to group by. If not specified, a single group containing all data objects will be used.",
"items": {"$ref": "#/definitions/FieldName"},
"type": "array"
}
},
"required": ["aggregate"],
"type": "object"
},
I can fix that by adding “groupby” to the “required” array, but then it complains about the same thing in the next definition, and this isn’t the right approach anyways. It seems the API is insisting that every property be required
, even when it isn’t required by the schema.
Is there a way to convince the API that this schema is valid, or is there a bug that its rejecting valid schemas?
TIA