← All labs
D4·Fix the code
Forcing JSON the old way
An extraction pipeline written against an older model has started returning 400s after a model upgrade. It worked unchanged for a year.
response = client.messages.create(
model="claude-opus-5",
max_tokens=4096,
messages=[
{"role": "user", "content": f"Extract the contact details:\n{text}"},
{"role": "assistant", "content": '{"name": "'},
],
)1.What causes the 400?
2.What replaces it when the goal is a guaranteed JSON shape?