TL;DR: For a chatbot API with long context, good quality means a contract pipeline, not a prompt call. Validate the model's JSON at the boundary, measure field-level rejection and repair rates, and retain a small, redacted sample of failures. The decision rule is straightforward: choose the runtime path that preserves required attributes and auditability under malformed input, even when its first-pass output rate is lower.
This article records that decision for a marketplace that turns supplier descriptions into searchable product attributes. The input is inconsistent prose: units mixed with marketing language, missing dimensions, variant details embedded in paragraphs, and occasionally contradictory claims. The output is a versioned object that downstream search and merchandising can trust.
What must remain true when the description is messy?
Three invariants define the boundary. Every accepted object must validate against the active schema.…