Back to glossary

Term

Prompt Template

A prompt template is a reusable prompt skeleton with placeholders that get filled with concrete values at runtime — the basis for reproducible LLM calls in applications.

Prompt Template — explained in more detail

Instead of writing every prompt from scratch, a template defines fixed structures — system instruction, role description, examples, output format — and marks the variable parts with placeholders like {{question}} or {user_input}. At runtime the placeholders are filled with concrete values. This makes LLM calls testable (same structure, different inputs), versionable and team-friendly: prompt changes happen in one place instead of scattered across the codebase.

Example / Practical context

In LangChain, LlamaIndex or frameworks like DSPy, templates are part of the basic toolkit. A simple example: "Summarise the following text in {n} bullet points:\n\n{text}". Anthropic and OpenAI offer prompt caching at the template level — the immutable part of the prompt is cached and only the variable inputs are re-billed. This makes a cleanly separated template economically attractive too.

Few-shot prompting typically uses a template with hard-wired examples. A system prompt is usually part of a template, but not a template on its own. Prompt chaining links multiple templates in a pipeline — the output of one call becomes the input for the next template.

Entdecke mehr

Themenuebersicht