Design Applications
What this topic covers
Choose model tasks and chain components to meet business needs, then shape prompts with clear schemas and constrained values. Specify JSON-only output when applications need predictable, parseable responses.
How do I get a model to return only JSON that my code can parse?
Give the prompt an explicit schema with named fields and constrained values, then tell the model to emit only JSON. The schema fixes the output contract, and the instruction to avoid surrounding prose keeps the response parseable. For example, list allowed values for a sentiment field so the model cannot invent new labels.