How it works
A template contains variables between braces, like "Summarize the text: {texto}". At runtime, the placeholder is replaced with the actual value and the final prompt is sent to the model. This standardizes the instruction and makes reuse easier, and it allows versioning like any other code artifact.
Practical example
A support template: "You are an assistant for company {empresa}. Answer in up to {limite} words: {pergunta}". Each call fills in empresa, limite and pergunta with different values, keeping the instruction consistent and auditable.
What it's for
It organizes code, avoids repetition and lets you version prompts like any other software artifact. It's the foundation of frameworks like LangChain and agent systems that need to generate prompts dynamically at runtime.
Best practices
Keep templates in versioned files, test them with different inputs and document the purpose of each variable. This makes maintenance, review and auditing of model behavior over time easier.