A code-enforcement office classifies inspection findings into a violation category that feeds monthly reporting. With a free-text category field, the same condition arrives as 'Overgrown vegetation', 'tall grass', and 'weeds/overgrowth', so counts by category are unusable. What is the right fix in the output contract?
Select an answer to reveal the explanation.
Short Explanation
Free text invites synonyms, and synonyms wreck any count. An enum of the office's violation codes turns "what would you call this?" into "which of these is it?"
Full Explanation
Whether monthly counts are meaningful is decided by the output contract, not by the reporting query that reads it. A free-text category field asks the model to name a condition, and naming is exactly where "Overgrown vegetation", "tall grass", and "weeds/overgrowth" come from: three defensible answers that group into three different buckets.
Constraining the category to an enum of the office's defined violation codes converts open-ended generation into selection from a fixed set, so only those exact values are valid. Records become comparable across inspectors and across months, a validator can reject an out-of-vocabulary value before it reaches the report, and the enum becomes the single place the taxonomy lives as codes evolve.
A synonym lookup table is perpetual cleanup that must be extended for every phrasing nobody anticipated; instructing the model to be consistent offers no shared vocabulary to be consistent with, and consistency across independent requests is precisely what free text cannot provide; and temperature 0 reduces sampling variation for a fixed prompt while different inspection narratives still elicit different plausible labels.
Exam caveat: an enum guarantees a valid value, not the right one, because a finding that fits no code will be forced into the nearest one, so the list needs an explicit other value plus a review path. Operational check: run a month of past findings through the constrained schema and audit how often other fires, which shows where the code list is incomplete.