JSON mode guarantees syntactically valid JSON but not that it follows your schema.
Structured outputs (schema-constrained decoding) guarantee the response matches a given JSON schema; best when you only need data back in a fixed format.
Function calling is for actions: the model chooses among tools and supplies arguments, and your code does something with them.
In all cases validate with a schema library such as Pydantic, handle refusals, and retry with the validation error when a response does not parse.
Loading…