Structured Output
AI gives me a big block of text I can't use directly. Can it return the answer in a fixed format?
AI gives me a big block of text I can't use directly. Can it return the answer in a fixed format?
Product review next Wednesday at 3:00 PM in A301. Alex is the owner.
{
"date": "next Wednesday",
"time": "15:00",
"room": "A301"
}Define the shape:Specify fields such as title, date, and location before asking the model to extract them.
Return the agreed fields:The model returns data in the required structure rather than a free-form summary.
Validate before use:The product checks the schema and real business rules before filling a form or creating an event.
Make task extraction return a fixed shape: title is required text; dueDate is YYYY-MM-DD or null; owner is text or null; status is one of todo, doing, done. Reject a missing title, invalid date, or unknown status before use; keep an absent due date as null rather than guessing. Test complete, no-date, and invalid-status inputs.