Prompt Template Builder
Write a prompt with variables in it, fill them in, and take away JavaScript and Python that renders it and refuses to render it half-filled.
Every variable in the template has a value.
- product
- 1× · provided
- customer_name
- 1× · provided
- plan
- 1× · provided
- ticket_body
- 1× · provided
- max_sentences
- 1× · provided
- Rendered characters
- 258
- Estimated rendered tokens
- ≈ 65
A prompt template is a string with holes in it, and every framework that offers you one is charging a dependency for twelve lines of code. The two outputs above are those twelve lines, in JavaScript and in Python, with the one thing that matters built in: it throws when a variable is missing instead of quietly rendering the word undefined into the middle of your prompt and sending it.
Silent substitution is the bug
The failure mode of every naive template is not a crash. It is a prompt that renders, sends, costs money and returns a confident answer about undefined. That is why the default here leaves an unfilled placeholder visible in the output rather than blanking it, and why the generated code has a required-variables list rather than trusting the caller.
Values are not escaped, deliberately
If ticket_body contains the closing delimiter you use to mark the end of user content, a determined customer can end your instruction block early and start writing their own. No template engine can fix that for you, because it cannot know which delimiter is structural. Wrap untrusted values in a delimiter you also strip from the value itself, and keep the instructions above the untrusted text rather than below it.