You need three fields from the model.
You let it answer in free prose, then scrape the values out with brittle regexes that break whenever the wording shifts.
- AWrite more regex patterns to cover every phrasing
- BAsk the model to return the three fields as a small structured object
- CLower temperature so the wording stays constant
- DAdd a second model that reads the prose and pulls the fields
Answer: B
Ask the model to return the three fields as a small structured object
Why
If you need structured data, ask for structured data - don’t coax prose and reverse-engineer it. Regex-scraping natural language is inherently fragile; letting the model emit the object directly removes the brittle layer entirely.
- Structured outputThe model hit the token limit halfway through a JSON object.
- Structured outputYour classifier uses DeepSeek’s JSON mode.
- Structured outputYou need reliable JSON from the model to feed a downstream service.
- Structured outputAbout 2% of responses come back as JSON with a trailing comma or a stray note before the object, and your pipeline crashes on them.
More on Way of the Agent
- Course programThe first three modules are free: start in the browser or the app, no card needed.
- Library: guides, skills and promptsReady prompt templates, grouped into collections.
- AI ChroniclesSourced stories from the history of AI.
- ConceptsPlain-language explainers of agent engineering.
- Learn AI agentsApps and courses for learning AI agents, compared honestly.
Real situations from building agents - with the answer and why.
Solve a new one every day on the Path