promptdojo_

Every prediction gets a name — step 6 of 7

Build the logger itself. Write log_prediction(log, model_version, input_hash, latency_ms, output) that:

  • Mints a prediction_id from the log's current length: pred-{len(log) + 1:06d} — first record is pred-000001.
  • Appends a dict to log with keys prediction_id, model_version, input_hash, latency_ms, output.
  • Returns the new prediction_id — the caller needs it to hand back to the user, or the join key dies right here.

Expected output:

pred-000001
pred-000002
records: 2
last output: will_stay

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