← Lesson
Hidden Scratchpads
Joeven
Run
Reset
Python loads on first run
turn = { "scratch": "get_job 17 returned error=timeout api_key=sk-live-abc", "final": {"status": "ok", "answer": "Job 17 failed: vendor timeout"}, } def for_user(turn): return turn["final"] def for_log(turn): text = turn["scratch"] return text.replace("sk-live-abc", "[redacted]") print("user sees", for_user(turn)) print("log sees", for_log(turn)) print("do not show scratch to user", "sk-live" not in str(for_user(turn))) print("raw scratch still has key", "sk-live" in turn["scratch"])
Run to execute this in your browser. Nothing is sent to a server.