How to Order Schema Fields So the Model Reasons Before It Answers
Put the reasoning field before the answer field in your schema so the model works it out before it commits.
THE FIELD GUIDE
Understand model formats, context windows, quantization, embeddings, and sampling before choosing settings for a real task.
Put the reasoning field before the answer field in your schema so the model works it out before it commits.
Mark optional fields nullable in your schema so the model returns null instead of inventing a value.
Get a model's function arguments as Structured Outputs by defining the function with a JSON Schema.
Get a list from a model as a JSON array by putting the array in the schema and naming the item fields.
Validate every model JSON reply against its schema in code, because a well-formed reply can still break your rules.
Extract invoice fields into JSON by giving the model a schema for the fields and the invoice text to read.
Handle Structured Outputs refusals and truncated replies in code instead of assuming every reply is complete JSON.
Write a JSON Schema that forces the fields you need and limits a choice to the values you allow.
Choose Structured Outputs when the field names matter, and JSON mode only when any valid JSON will do.
Get JSON that matches your schema every time by sending a JSON Schema with Structured Outputs.