promptdojo_

Schemas, Pydantic, and validation — making the model return real data — step 7 of 9

The model returned "5" (a string) for severity instead of 5 (an int). The assert isinstance(...) check on line 6 fails. Fix line 4 so the script coerces severity to an int before validating.

Expected output:

severity: 5
The break is on line 4 — but read the whole snippet first.

full-screen editor opens — close anytime to keep reading.