You need the app to return consistent JSON for a downstream system. What is the best approach?
Why D is the answer
Use structured output with a defined schema and validate it
A schema constrains the output, and validation catches the rest.
In detail
- A downstream system needs a fixed shape.
- A schema constrains the output, and validation catches what is left.
- Decide what happens on a validation failure, such as one retry or a review queue.
Use case
An illustrative scenario, not a real incident.
A claims system reads the app's reply, and one extra sentence breaks it. A defined schema shapes the output, and a validation step catches anything that still fails.
See it in different ways
sequenceDiagram participant C as pyfunc chain participant M as MLflow participant U as Unity Catalog participant S as Model Serving C->>M: Log the model M->>U: Register a version U->>S: Deploy to an endpoint
flowchart LR S0["Prompt with schema"] --> S1["Model output"] --> S2["Validate"] --> S3["Downstream system"]
Key point: A schema shapes output, and validation confirms it.
Why the other options are wrong
- A. Raise the temperature and retry on failure
- Higher temperature adds variety, which is the opposite of what you need.
- B. Parse the free text with a long regular expression
- Regular expressions over free text break when the wording changes.
- C. Ask for JSON politely in the prompt and trust what comes back
- A polite request is not a guarantee.

