Fix Invalid JSON from AI
The JSON won't parse and you can't see why. Deterministic cause-sniffing — trailing commas, single quotes, unclosed brackets — and the repair prompt that fixes it.
The model answered "Complaints" — your set says "Complaint". One character of drift, one broken dashboard. Caught before it counts.
Invalid labels poison aggregations silently: "Complaints" instead of "Complaint" creates a new category with a count of one, dashboards fragment, and nobody notices until the quarterly review. This setup validates a feedback classification that returned a near-miss label outside the defined set — the plural drift that exact string matching downstream will treat as a brand-new category. The validator flags it as a fail with the full allowed set in the repair, and the fix costs one message instead of one data-cleaning sprint.
Validate at the gate
Between the model and the database — the only place a label fix is one message cheap.
Watch for near-misses
"Complaints" vs "Complaint" is the signature drift: too close for a human to flag, far enough to fragment data.
Repair with the full set
The repair prompt lists every allowed label — the model picks the right one with the set in view.
It flags the value in PROBLEMS FOUND as "Invalid label: \"Complaints\" — not in the defined label set", and the Fix line lists the full allowed set (Praise, Complaint, Feature Request, Bug Report, Question) so the model re-picks with every option in view. The ai-output-validator surfaces the drift and generates this repair; you run it in your assistant and confirm the returned label before it hits your database.
The OUTPUT RULES constrain it to fix only the listed problems and keep everything already correct unchanged, with no explanations or code fences in the reply. It checks set membership and format, not multi-label ordering, per the notFor. The validator surfaces issues but doesn't guarantee it catches every possible drift, so a human still owns the final gate before data enters counts.
The JSON won't parse and you can't see why. Deterministic cause-sniffing — trailing commas, single quotes, unclosed brackets — and the repair prompt that fixes it.
Paste the response, get the verdict: real JSON parsing, missing-field detection, and a repair prompt for everything found.
Grade agent output the same way every time — a rubric scoring correctness, grounding, safety, tone, and completeness, with a pass threshold instead of a gut call.
Stop getting 'Sure, here is the JSON…' — the output-contract pattern that forces models to return only parseable JSON: schema, example, and a strict rule block.
Free text in, named fields out. The extraction prompt pattern that turns any unstructured text into consistent, parseable records.
Billing, Technical, Account, How-To, Feature Request — ticket triage with definitions that decide the borderline cases for the model.
Paste an AI's output and validate it against the expected format — with a repair prompt for every failure found.