MMOOZZGG.com

Glossary

What is a prompt template

In short

A prompt template is a ready-made task for an AI model with fixed text and empty fields. A program or an employee fills the fields with the data of a specific case.

Prompts · prompt template

MMOOZZGG.com editorsChecked: 2 min read

For a child

Remember greeting cards that already say “Happy birthday!” and leave a space for a name? You can sign one card for your mom, a friend or your grandma, and each time it becomes a different card. Grown-ups make similar blanks for requests to a smart program: the words of the request stay the same, and each time a new name or a new task goes into the empty space.

In plain words

When the same task goes to an AI model hundreds of times, writing the request again each time is slow and risky: someone will forget an important condition. So people make a template. It has a fixed part: the role, the rules and the answer format. In a few places it has labels like {{client_name}} or {{request_text}}. A program puts the data from the request there and sends the finished prompt to the model. This way a shop gets answers in one format to thousands of emails, and only the content changes. It works like a form at a clinic: the fields are the same, but each patient’s form is filled in differently.

For business

Templates turn a good prompt into part of the workflow: replies to clients, product cards and call summaries come out in one style, whoever runs them. A template is stored like code, with versions, an author and the date of each change. This shows after which edit quality went up or down. The money goes into setup and testing, and the call itself costs the same as a normal prompt of the same length. The main risk is in the filled fields: if a client’s text goes into a field, it can carry foreign instructions. So the data is separated from the rules with markup, and the assistant’s rights are limited in the systems themselves. An AI assistant built into a CRM and email runs on templates like these.

For a specialist

A prompt template is a parameterized string, or a set of messages, with variables (placeholders) that are filled at each model call. In the survey by Liu and co-authors (2021), the template is part of the prompting function. The input x becomes a string x’ with unfilled slots that the model completes. This turns a classification or translation task into a form that a pre-trained model knows. In modern applications a template usually assembles the system message, examples (few-shot), documents from a search and the user’s input. The Anthropic guide advises wrapping the instructions, the context, the examples and the variable input data in separate XML tags, so that the model does not mix them up. Do not confuse this idea with the chat template in the Transformers library. A chat template turns a list of messages with roles into a sequence of tokens with control labels, which differ for each model, and an error in it sharply lowers answer quality. Teams keep prompt templates under version control, test them on sets of examples, and isolate user fields from the instructions to lower the risk of prompt injection.

Example

The sales team keeps a template: “You are a company manager. Write to client {{name}} about the renewal of contract {{number}}. Use a business tone, no longer than one paragraph.” The CRM fills in the data and sends dozens of these prompts to the model every day.

Related terms

Questions and answers

Why use a prompt template? It makes answers the same in quality and format, whoever starts the task. A good request is written once, and then only the data changes.
How do you protect a template from prompt injection? Separate the user’s text from the instructions with tags, and tell the model directly that it is data, not commands. More important: limit the rights of the assistant in the systems themselves.

Then a foreign instruction in a field changes little.

Sources

Where companies use it

Not sure whether your company needs this?

AI solutions map
Contact us