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.
Fields checked against the contract: missing ones flagged, invented ones caught, prose around the object detected.
Structured output drifts in three ways: fields go missing, fields get invented, and prose creeps in around the object. This setup validates an extraction response that does all three at a typical scale — a friendly "Sure! Here is the extracted data:" preamble, a missing timeline field, and an invented notes field. The validator separates them by severity (missing = FAIL, invented = WARN, prose = WARN), and the repair prompt addresses each one specifically, including the null-over-invention rule for the missing field.
Reuse your generator's field list
The fields you defined in the extraction prompt are exactly the expected structure here.
Mind the severity split
Missing fields fail; invented fields warn — your pipeline may tolerate extras but never absences.
Repair with null discipline
The repair prompt says "use null if the value is unknown — never invent one"; the fix doesn't become a new violation.
The severity split weights them differently: the missing "timeline" field is a FAIL while the invented "notes" field is only a WARN. A consumer reading the six expected fields can usually ignore an extra key, but a downstream absence breaks it. The REPAIR TASK flags both directions and gives a specific fix for each; you decide which one blocks your pipeline.
It fixes the absence without inventing content. The rule for the missing "timeline" reads "include timeline; use null if the value is unknown — never invent one," so the repair adds the key with null rather than a guessed date. That keeps the correction from becoming a second violation. You paste the repaired output back into your own assistant.
A REPAIR TASK prompt listing the problems it found — prose outside the JSON, the missing "timeline", the unexpected "notes" — each with a specific fix. The validator surfaces and packages the issues; it does not re-run your model or promise it caught every drift. You paste that repair prompt back to the assistant that produced the bad output.
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 pages that rank at scale, not penalty bait — map the intents, build the data set, structure it, template the page, then QA before publishing hundreds.
The full path to automation that survives the real world — wire the integrations and triggers, design the control API, move the data through validated stages, evaluate the AI steps, then deploy.
The full path to a pipeline that moves data without corrupting it — design the ingestion and transforms, extract and structure the sources, gate the quality, store it, then deliver and ship it monitored.
Turn messy text into structured data you can trust enough to feed another system — bound the source, extract the fields, force clean JSON, and validate before it flows downstream.
Generate many intent-matched SEO pages from a template without the thin-content spam — map the search intents, define the page variables, build the template, and QA before publishing at scale.
Design a pipeline that moves data without corrupting it — map the sources and ingestion, design the transformation stages, set validation and quality gates, then document the pipeline and monitoring.
AI pulls the fields you asked for, but hands back a flat list with no way to tell which values it read from the document and which it guessed. Here's how to make each extracted value carry its source quote, location, and a review flag — so you can check the result instead of trusting it.
You ask AI to fill a table — issue_type, priority, reason — and the same column gets filled by different logic each row: priority as urgency here, sentiment there. Here's how to define each field's meaning, allowed values, and include/exclude rules so AI fills them consistently.