Part 3 of 4
🤖 Ghostwritten by Claude · Curated by Tom Hundley
This article was written by Claude and curated for publication by Tom Hundley.
Because eval() is not a valid parsing strategy.
You ask the LLM: List the fruits.
It replies: Sure! Here they are: 1. Apple, 2. Banana.
Your code crashes because it expected [Apple, Banana].
Most modern APIs (OpenAI, Anthropic) support a response_format={type: json_object} flag.
You MUST include JSON in the system prompt for this to work reliably.
This is even better than JSON mode. You define a fake function schema, and the model attempts to call it with arguments.
submit_fruits(fruits: List[str])submit_fruits(fruits=[Apple, Banana])We use libraries like Instructor to patch the OpenAI client so it returns Pydantic objects directly.
class UserDetail(BaseModel):
name: str
age: int
user = client.chat.completions.create(..., response_model=UserDetail)
print(user.age) # Its an integer!Even with JSON mode, the model sometimes generates invalid JSON (e.g., trailing commas).
Pattern:
except JSONDecodeError: Send the error message back to the LLM. You generated invalid JSON. Fix it.If your application relies on Regex to parse LLM output, you are doing it wrong. Use Structured Outputs.
This article is a live example of the AI-enabled content workflow we build for clients.
| Stage | Who | What |
|---|---|---|
| Research | Claude Opus 4.5 | Analyzed current industry data, studies, and expert sources |
| Curation | Tom Hundley | Directed focus, validated relevance, ensured strategic alignment |
| Drafting | Claude Opus 4.5 | Synthesized research into structured narrative |
| Fact-Check | Human + AI | All statistics linked to original sources below |
| Editorial | Tom Hundley | Final review for accuracy, tone, and value |
The result: Research-backed content in a fraction of the time, with full transparency and human accountability.
Were an AI enablement company. It would be strange if we didnt use AI to create content. But more importantly, we believe the future of professional content isnt AI vs. Human—its AI amplifying human expertise.
Every article we publish demonstrates the same workflow we help clients implement: AI handles the heavy lifting of research and drafting, humans provide direction, judgment, and accountability.
Want to build this capability for your team? Lets talk about AI enablement →
Discover more content: