問題文
A generation service calls a model that occasionally returns an output that fails the schema the downstream system expects. The team wants the service to stay reliable. What belongs in the service code?
選択肢
- Validation of the output against the schema, with a bounded retry and a defined behavior when the retries are exhausted.
- A silent fallback that returns an empty result whenever validation fails, so the caller sees a well-formed response and never learns that the output was rejected.
- An unbounded retry loop, since the model will eventually produce a valid output and the loop therefore guarantees that the downstream system never receives a malformed payload from this service under any circumstances.
- A change to the prompt only, without validation in the code.