Prompt Template
Also known as: Template, Prompt Format, Message Template
Definition
A structured prompt with placeholders (variables) that are filled in at runtime with specific values. Templates separate the prompt structure (fixed text, instructions, formatting) from the dynamic content (user input, retrieved context, examples). They enable reusable, maintainable, and testable prompt designs.
What this is NOT
- Not a hardcoded prompt (templates have variables)
- Not the rendered prompt (templates are the structure, not the filled result)
- Not a prompt library (templates are individual; libraries are collections)
Alternative Interpretations
Different communities use this term differently:
llm-practitioners
A string or document with variable placeholders (e.g., {user_input}, {{context}}) that are rendered with actual values before being sent to the model. Frameworks like LangChain, Jinja2, and Mustache provide template functionality.
Sources: LangChain PromptTemplate documentation, LlamaIndex prompt templates, General templating practices
Examples
- "Answer the following question based on the context. Context: {context} Question: {question} Answer:"
- Templates with conditional sections based on input type
- Multi-language templates with locale-specific phrasing
- LangChain PromptTemplate with input_variables
Counterexamples
Things that might seem like Prompt Template but are not:
- A hardcoded prompt with no variables
- A rendered prompt (the output, not the template)
- Dynamic prompt generation that doesn't use a fixed structure
Relations
- produces prompt (Templates are rendered into prompts)
- overlapsWith few-shot-prompting (Templates often have slots for examples)
- overlapsWith system-prompt (System prompts are often templated)
Implementations
Tools and frameworks that implement this concept:
- Dify secondary
- LangChain secondary
- Langfuse secondary
- LangSmith secondary
- Semantic Kernel secondary