Also - titles are are auto-generated from the class names. You do not need to override them unless you’ve got a much better schema for the AI to see as response_format.
The quality of the schema actually sent and understood is reflected in the quality of the contents produced (AI can’t choose not to follow the container, though, but can misuse arrays).
For functions, titles are just part of the description the AI receives.
You might be curious if one logs OpenAI’s Python pydantic construction of the code above, showing each schema object created to develop the final response format schema, in this case, nested.
{'description': 'A detailed explanation of the step.', 'title': 'Explanation Title', 'type': 'string'}
{'description': 'The output result of the step.', 'title': 'title_step-output', 'type': 'string'}
{'properties': {'explanation': {'description': 'A detailed explanation of the step.', 'title': 'Explanation Title', 'type': 'string'}, 'output': {'description': 'The output result of the step.', 'title': 'title_step-output', 'type': 'string'}}, 'required': ['explanation', 'output'], 'title': 'Step', 'type': 'object', 'additionalProperties': False}
{'$ref': '#/$defs/Step'}
{'description': 'A list of steps involved in solving the problem.', 'items': {'$ref': '#/$defs/Step'}, 'title': 'title of steps', 'type': 'array'}
{'description': 'The final answer to the problem.', 'title': 'title of answer', 'type': 'string'}
{'$defs': {'Step': {'properties': {'explanation': {'description': 'A detailed explanation of the step.', 'title': 'Explanation Title', 'type': 'string'}, 'output': {'description': 'The output result of the step.', 'title': 'title_step-output', 'type': 'string'}}, 'required': ['explanation', 'output'], 'title': 'Step', 'type': 'object', 'additionalProperties': False}}, 'properties': {'steps': {'description': 'A list of steps involved in solving the problem.', 'items': {'$ref': '#/$defs/Step'}, 'title': 'title of steps', 'type': 'array'}, 'final_answer': {'description': 'The final answer to the problem.', 'title': 'title of answer', 'type': 'string'}}, 'required': ['steps', 'final_answer'], 'title': 'MathResponse', 'type': 'object', 'additionalProperties': False}
What’s being sent as response_format when I modify the titles to make them obvious, before conversion to JSON:
{'$defs': {'Step': {'properties': {'explanation': {'description': 'A detailed explanation of the step.', 'title': 'Explanation Title', 'type': 'string'}, 'output': {'description': 'The output result of the step.', 'title': 'title_step-output', 'type': 'string'}}, 'required': ['explanation', 'output'], 'title': 'Step', 'type': 'object', 'additionalProperties': False}}, 'properties': {'steps': {'description': 'A list of steps involved in solving the problem.', 'items': {'$ref': '#/$defs/Step'}, 'title': 'title of steps', 'type': 'array'}, 'final_answer': {'description': 'The final answer to the problem.', 'title': 'title of answer', 'type': 'string'}}, 'required': ['steps', 'final_answer'], 'title': 'MathResponse', 'type': 'object', 'additionalProperties': False}