Prompt template
Definition
A prompt with placeholders, such as {question} or {context}, that code fills in at run time so the instructions are reused.
In more detail
Templates separate the fixed instructions from the variable parts: the user's question, retrieved documents, today's date. That makes prompts testable and versionable like code, and tools such as Langfuse and LangSmith store templates with version history so you can compare versions in evals.
Two habits help. Keep the stable part first so it can be cached, and wrap inserted content in clear delimiters, such as XML-style tags, so the model can tell instructions from data. That also limits, but does not remove, the risk of prompt injection through inserted text.
Related terms
Few-shot prompting
Including a few input and output examples in the prompt so the model can copy their pattern, format and level of detail.
Prompt
The input given to a model: instructions, context, examples and the question or task itself, sent as one or more messages in a request.
System prompt
Instructions set by the application developer that frame every conversation, such as the assistant's role, rules and output format.
Stop sequence
A string sent with a request that makes the model stop generating as soon as it produces that text.
Read more about Prompt template
- Prompting fundamentals: clear tasks, examples and formats
How to write a good prompt: frame the task, say who the output is for, show an example and specify the format, so a model's answers are useful and repeatable.
- Langfuse
Tracing, prompt management and evals for LLM applications.
- Prompt engineering
Writing clear, testable instructions for models and checking them on real inputs.