Practice Lab: Engineer a Structured Extraction Prompt
Explore how to design and refine structured extraction prompts to transform AI feedback into accurate JSON data. Learn to handle common prompt failures, enforce strict output formats, and iteratively improve responses for reliable backend AI integration.
We'll cover the following...
This chapter covered the process step by step: shaping the prompt, defining the JSON structure, specifying allowed values, adding a fallback, and asking the model to return a confidence estimate. This lab focuses on applying the techniques from the chapter rather than introducing new concepts. It gives you a task and a checklist, and your job is to write the prompt yourself, test it, observe where it produces invalid or inconsistent output, and revise it. This is the same iteration loop engineers use before integrating a prompt into production code.
The task
You're building the exact kind of feedback-analysis feature from this chapter's checkpoint. Here's the fixed piece of customer feedback your prompt needs to handle:
"I've emailed support twice about this and haven't heard back in four days. The product itself is fine; I just need someone to actually respond."
Your job is to write a single prompt that gets a model to analyze this feedback and return only a JSON object: nothing before it, nothing after it, and no code fence. It should match ... ...