promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_

FastAPI inference shape — step 7 of 7

Checkpoint

One last thing before we move on. pass this to mark the lesson done, or skip and keep moving. hop to the next when you're ready.

Harden the endpoint to a two-field contract: predict(payload) must verify BOTH tickets and logins are numbers (in that order), returning ({"error": f"{field} must be a number"}, 422) for the first failure; valid requests score against the cutoff, append {"in": ..., "score": ..., "v": ...} to LOG, and return the versioned 200. Run the three requests, printing status and body for each, then f"logged {n} prediction(s); rejected {m}". Note the third request fails on a MISSING field — .get returns None, and None isn't a number.

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