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.
Label in the set? Case exact? Confidence in range? The checks that keep classification output usable for routing.
Classification output fails subtly: the label is right but lowercase, the confidence is a number when you expected a level — or it's 120 on a 0–100 scale. This setup validates a CRM stage classification with two such violations: "demo" instead of the defined "Demo" (case mismatch — a warning that breaks exact-match routers), and a confidence of 120 (out of range — a fail that poisons thresholds). Both get specific repairs: return the label exactly as defined; report confidence between 0 and 100.
Paste the allowed labels exactly
Case matters: the validator flags "demo" vs "Demo" because your router will too.
Check confidence semantics
Numbers get range-checked 0–100; strings must be high/medium/low — whichever contract you set.
Repair before routing
A repaired label is cheaper than a misrouted ticket — validate at the gate, not after the incident.
It does not judge correctness, only conformance. Ai Output Validator checks membership in the defined set (Discovery Call, Demo, Negotiation, Follow-Up, Closed Won, Closed Lost), exact case, and confidence range, then repairs the two seeded faults: "demo" to "Demo" and 120 back into 0 to 100. Whether Demo was the right call for that activity needs a human, not this check.
It flags 120 as out of range against the expected 0 to 100 scale and repairs it to a number within range. That figure is the model's self-reported confidence, not a measured accuracy, so a repaired, in-range score still is not proof the label is trustworthy for routing. The OUTPUT RULES then return only the corrected classification.
Only the corrected classification; the OUTPUT RULES require no explanations, no commentary, and no code fences, and everything already correct stays unchanged. It fixes only the two listed problems, the case mismatch and the range violation, and touches nothing else, so you get a routing-ready string rather than a diff to parse.
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.
The full path to a content operation that runs, not a pile of posts — set the editorial strategy, research the topics, build a reusable template, then produce and QA structured pieces on repeat.
Build a text classification step you can automate on — pull out the unit to classify, assign a label from a fixed set, and validate the label is one you actually allow.