One Template, Any Tone
system-prompt templating
Part of: Tone Rewriter
A hardcoded "formal" rewriter is one tone stuck in code. To support formal, casual, friendly, and whatever comes next, you don't write a new function per tone. You write one template with a hole where the tone goes. The template idea A system-prompt template is a string with a placeholder you fill at call time. In Python the cleanest tool for that is str.format with a named field: Call build system("formal"), then build system("casual"), then build system("friendly"), and you get three tailored system prompts from one source of truth. Change the rules once and every tone picks up the change. Wiring it into the call The template feeds straight into the API call. The user message never changes shape; only the system string swaps: One function, any tone. That's the payoff of templating: the tone becomes a parameter instead of a copy-pasted function. Why not f-strings everywhere? You could use an f-string inline. Pulling the template out as a named constant with {tone} gives you one place to edit the rules, keeps the wording consistent across tones, and lets you test the template on its own (which you'll do below). A prompt reused a thousand times deserves to live in one spot. Watch th
Challenge: Fill the Prompt Template