← Lesson
Version Your Prompts
Joeven
Run
Reset
Python loads on first run
import hashlib def prompt_id(spec, shots, contract): blob = spec + "\n" + shots + "\n" + contract return "billing-" + hashlib.sha256(blob.encode("utf-8")).hexdigest()[:8] v1 = prompt_id("JSON only. No refunds.", "q: status a: get_job", '{"status": str}') v2 = prompt_id("JSON only. Be nicer. No refunds.", "q: status a: get_job", '{"status": str}') print("v1", v1) print("v2", v2) print("nicer is a new version", v1 != v2) trace = {"prompt_id": v2, "passed": 3, "n": 4, "model": "tiny-1"} print("trace", trace) print("same inputs same id", prompt_id("JSON only. No refunds.", "q: status a: get_job", '{"status": str}') == v1)
Run to execute this in your browser. Nothing is sent to a server.