5. Structured Output — Machine Talks to Machine

  Prompt: "Below is a list of restaurant reviews.
           Extract the details and structure
           your response as follows:
           {
             "name": "...",
             "cuisine": "Italian | French | ...",
             "price_range": "$ | $$ | $$$",
             "vegetarian_friendly": true | false
           }"
                     │
                     ▼
              ┌─────────────┐
              │     LLM     │
              └─────────────┘
                     │
                     ▼
           {
             "name": "Trattoria Milano",
             "cuisine": "Italian",
             "price_range": "$$",
             "vegetarian_friendly": true
           }

LLMs can produce more than flowing prose — they can generate highly structured data formats such as JSON or XML. Include the desired format in the prompt, and the model fills it in. Modern LLMs even offer constraint modes that guarantee the output conforms to a given structure, producing nothing else.

Why this matters:

← 4. The System Prompt
6. Tool Use →