Example of one of my Structured Response Format that is working 100% of the time (only available on openAI models):
If it can help
{
"type": "json_schema",
"json_schema": {
"name": "categoryAnswerabilitySchema",
"strict": true,
"schema": {
"type": "object",
"properties": {
"category": {
"type": "string",
"description": "Must be the exact parent category from the reference data"
},
"subcategory": {
"type": "string",
"description": "Must be a subcategory that belongs to the specified category"
},
"ai_answerable": {
"type": "boolean",
"description": "Indicates if the subcategory is answerable by AI"
}
},
"required": ["category", "subcategory", "ai_answerable"],
"additionalProperties": false
}
}
}