Command Palette

Search for a command to run...

Hectal
Phase 11: Observability and Operations
LLM Engineering · Exercise 1 of 5Next
Intermediate

Redact, then log

Write redact(text) that replaces every email (letters, digits, dots, dashes and underscores, then @, a domain with a dot) with [EMAIL] and every run of exactly 10 digits (not part of a longer number) with [PHONE].

Write log_line(event, fields) that returns one line of compact JSON (separators=(",", ":")) with "event" first and then the fields in the order given. If the fields contain a "prompt" key, its value must be redacted before it is written.

What Check tests

  1. redact hides an email
  2. redact hides a 10-digit phone number
  3. A 12-digit number is not a phone number
  4. log_line writes compact JSON with the event first
  5. log_line redacts the prompt before writing

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

main.py
Sign in to run your code.

Output

Press Run to see what your program prints.