PRODUCTION SCENARIO
A Generative AI Engineer sends claim summaries from a chat model on a Foundation Model APIs endpoint into a claims system that expects five fixed JSON keys. About 8% of responses arrive with extra prose or a missing key and fail to parse.
What should the engineer change in the request so every response follows the schema?
Answering here is anonymous. Nothing is saved unless you sign in.
Show answer and explanation
Answer: Set response_format to a json_schema type that declares the five required keys
Structured outputs on Foundation Model APIs let a chat request declare a JSON schema through response_format, so the output adheres to that schema rather than merely being asked for JSON. Prompt wording, temperature, and post-hoc parsing reduce failures but do not enforce the shape.