I’m fine tuning GPT4 in strict-mode and provided the following json_schema (which is actually the json representation Chat GPT says to use as well):
json_schema= {
"name": "table_component",
"strict": True,
"schema": {
"type": "object",
"properties": {
"table": {
"type": "object",
"properties": {
"name": {"type" : "string"},
"columns": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name" : {"type" : "string"},
"type" : {"type" : "string"}
},
"required" : ["name", "type"],
"additionalProperties" : False
}
}
},
"required": ["name", "columns"],
"additionalProperties" : False
},
"component" : {"type": "object"}
},
"required" : ["component","table"],
"additionalProperties" : False,
}
}
which creates the following JSON:
{'name': 'table_component',
'strict': True,
'schema': {'type': 'object',
'properties': {'table': {'type': 'object',
'properties': {'name': {'type': 'string'},
'columns': {'type': 'array',
'items': {'type': 'object',
'properties': {'name': {'type': 'string'}, 'type': {'type': 'string'}},
'required': ['name', 'type'],
'additionalProperties': False}}},
'required': ['name', 'columns'],
'additionalProperties': False},
'component': {'type': 'object'}},
'required': ['component', 'table'],
'additionalProperties': False}}
When supplying this JSON to repsonse_format I consistently get the following error:
BadRequestError: Error code: 400 - {'error': {'message': "Invalid schema for response_format 'table_component': In context=(), 'required' is required to be supplied and to be an array including every key in properties. Extra required key 'component' supplied.", 'type': 'invalid_request_error', 'param': 'response_format', 'code': None}}
However, you can see that my required_properties parameter is at the same level as the schema and included the two properties - table and component.
Anything seem wrong to you here?