Template
A template is a reusable structure with fixed elements and variable parts for creating or generating similar content, outputs, or artifacts.
Grokking AI Applications
A structured prompt format organized into role, task, features, and examples.
- How it is used
- Structures reusable LLM instructions so applications can assemble clear prompts from stable guidance and changing inputs.
- How deep it goes
- Explains four prompt parts, variables, history injection, enhancements, and Langflow and Python implementations without model internals.
- Examples
- Uses a breed placeholder, a Pirate English assistant with history, and a chef–dietitian recipe pipeline.
- What you can do after
- Apply it via Langflow or Python to build reusable prompts that insert inputs, history, and sequential model outputs.
Learn Go with Pocket-Sized Projects
A template is a structured representation that combines static text with placeholders for dynamic values and can be parsed and executed to produce output.
- How it is used
- Replaces cumbersome string formatting when rendering HTML pages and other mostly static output with changing values.
- How deep it goes
- Works through parsing, execution, actions, control flow, functions, and named files, while stopping short of template-engine internals.
- Examples
- Uses a rendered habit list, formatted week dates, progress-based CSS classes, and a reusable list-item template.
- What you can do after
- Build it from scratch with Go’s template packages to render data-driven HTML and reusable template fragments.
Read how Learn Go with Pocket-Sized Projects explains template →
Spring AI in Action
A prompt template is a reusable prompt structure containing static text and placeholders that are filled with varying model data.
- How it is used
- Organizes sophisticated Spring AI prompts for contextual, conversational, retrieval-based, translation, and sentiment-generation workflows.
- How deep it goes
- Defines placeholders, binds parameters, externalizes files, and adds behavioral instructions, while deferring model internals.
- Examples
- Uses tabletop-game questions, external rule documents, translation requests, predefined MCP prompts, and sentiment-analysis endpoints.
- What you can do after
- Build it from scratch with Spring AI by defining reusable prompts, binding request data, externalizing templates, and constraining generated answers.
Data Analysis with LLMs
A prompt template is a reusable text specification containing placeholders that can be replaced with input-dependent content to produce a prompt.
- How it is used
- Reuses fixed instructions while substituting changing data or questions for repeated analysis and query translation.
- How deep it goes
- Defines placeholder substitution and works through Python prompt functions and a LangChain chat-template implementation.
- Examples
- Illustrates fixed examples in a laptop-review template and two changing inputs in email attribute extraction.
- What you can do after
- Build it from scratch with a Python prompt function or apply it via LangChain’s ChatPromptTemplate for text classification.
Build AI-Enhanced Web Apps
A prompt template is a reusable specification for constructing prompts by inserting variable inputs and, optionally, example instructions.
- How it is used
- Constructs reusable model prompts from runtime inputs for chains, streaming conversations, and retrieval-augmented answers.
- How deep it goes
- Works through placeholder substitution, few-shot components, and runnable-chain placement, without descending into model internals.
- Examples
- Uses a vowel-count chain, a question–answer few-shot template, a streaming chat handler, and a context-grounded RAG prompt.
- What you can do after
- Apply it via LangChain.js to format user input and retrieved context before passing prompts to a model or streaming handler.
AI Agents and Applications
A prompt template is a reusable structure that combines user input, context, and optionally examples into a model request.
- How it is used
- Standardizes dynamic model requests for summarization, research, and retrieval-augmented Q&A.
- How deep it goes
- Works from a Python function through formatting and invoking LangChain templates, then extends to few-shot and retrieval prompts.
- Examples
- Uses adjustable aqueduct summaries, number-classification examples, research-query generation, and a retrieved-context Q&A prompt.
- What you can do after
- Apply it via LangChain’s PromptTemplate to format variable inputs for a model, or FewShotPromptTemplate to manage injected examples.
Natural Language Processing in Action, Second Edition
A prompt template is a reusable specification that inserts variable input into a predefined language-model prompt.
- How it is used
- Supports controlled chatbot response generation by reusing fixed wording with variable user input.
- How deep it goes
- Defines placeholders and demonstrates LangChain setup, use in a chain, and inclusion of conversation history.
- Examples
- Uses a math-tutor chatbot with message and chat-history placeholders, including parent-permission onboarding instructions.
- What you can do after
- Apply prompt templates with LangChain by declaring input variables and passing values to a chain.
Read how Natural Language Processing in Action, Second Edition explains template →
Hugging Face in Action
PromptTemplate is a LangChain class that represents a parameterized string template and formats user-provided input variables into a prompt.
- How it is used
- Structures reusable instructions and queries before they enter LLM, conversation, retrieval, or data-querying workflows.
- How deep it goes
- Explains placeholders, input_variables, invocation, chaining, history, and retrieved context, but does not descend into template parsing internals.
- Examples
- Demonstrates question answering, conversational history, document retrieval, DataFrame queries, Langflow prompts, and weather-report generation.
- What you can do after
- Build it from scratch using PromptTemplate, supply named variables, invoke chains, and connect prompts to local or hosted models.
Machine Learning Platform Engineering
A user prompt template is a parameterized structure for formatting user-provided content into a language-model request.
- How it is used
- Formats retrieved context and a user query into a consistent LLM request for grounded RAG responses.
- How deep it goes
- Shows string interpolation, then versioned fetching, variable compilation, configuration, tracking, and fallback; stops short of detailed context optimization.
- Examples
- Uses a documentation question with retrieved context, a labeled Context/Question/Answer prompt, and a managed chat-template workflow.
- What you can do after
- Apply it via Langfuse to compile runtime values, promote prompt versions, and track which version produced a response.
Read how Machine Learning Platform Engineering explains template →
Go in Practice, Second Edition
An HTML template is a document template containing markup, data substitutions, and control logic for generating output.
- How it is used
- Generates maintainable HTTP HTML and email content from structured templates rather than directly formatted output.
- How deep it goes
- Works through field substitution, iteration, context-aware escaping, custom functions, and email rendering with Go implementations.
- Examples
- Uses an HTML page with comments, a date-formatting function, and a templated email message.
- What you can do after
- Build it from scratch using Go templates to render HTML pages or email, with iteration and custom display functions.
Software Testing with Generative AI
A prompt template is a reusable prompt structure that combines fixed instructional text with fields populated from input data.
- How it is used
- Shapes fine-tuning examples and the prompts delivered to the model.
- How deep it goes
- Explains wording effects, tokenizer alignment, and context length without detailing tokenization mechanics.
- Examples
- Uses a BrandingServiceTest question, a JSON training pair, and Java Mockito initialization code.
- What you can do after
- Apply it by varying instructions, aligning tokenizers, and checking prompt size against context length.
Read how Software Testing with Generative AI explains template →
Quarkus in Action
A Qute template is a structured document containing markup and Qute expressions that can be rendered with supplied parameters.
- How it is used
- Renders a reservation page and HTML fragments that HTMX replaces after backend requests.
- How deep it goes
- Works through template inputs, expressions, loops, and REST rendering without detailing Qute engine internals.
- Examples
- Uses a reservation header, available-cars table, and reservations table.
- What you can do after
- Build it from scratch: render separate page and table templates through REST methods for an HTMX-driven UI.
The Well-Grounded Python Developer: How the pros use Python and Flask
A template is a document containing fixed content and placeholders or directives that are resolved to produce a rendered document.
- How it is used
- Combines server-generated data with reusable HTML to serve dynamic pages through Flask routes.
- How deep it goes
- Works from placeholder substitution through inheritance, iteration, conditionals, and custom filters without detailing template-engine internals.
- Examples
- Uses a current-time homepage and a post list rendered as Bootstrap cards.
- What you can do after
- Apply it via Flask and Jinja2 to render dynamic pages with shared layouts, post lists, and formatted timestamps.
Read how The Well-Grounded Python Developer: How the pros use Python and Flask explains template →
Build a Reasoning Model (From Scratch)
A fixed prompt structure used to shape how an LLM formats and reasons in its response.
- How it is used
- Uses fixed instructions and answer formatting to support automated evaluation of mathematical reasoning models.
- How deep it goes
- Implements rendering, generation, extraction, and grading, then defers template selection to larger-dataset comparison.
- Examples
- Demonstrates boxed math answers, a rendered algebra problem, and an end-to-end MATH-500 evaluation pipeline.
- What you can do after
- Apply it via Python to render prompts, generate responses, extract answers, and measure accuracy across math examples.
Read how Build a Reasoning Model (From Scratch) explains template →
ASP.NET Core in Action, 3e
A software template is a predefined starting structure containing code and configuration for building an application.
- How it is used
- Starts application development with predefined code and configuration that can be customized into an app.
- How deep it goes
- Defines templates and demonstrates creating and running apps, then examining generated files and project structure.
- Examples
- Uses Razor Pages and MVC starters, including a basic Welcome page and a CLI project-creation sequence.
- What you can do after
- Apply it via Visual Studio or the .NET CLI to create and run a starter ASP.NET Core application.
Data Storytelling with Altair and AI
A prompt template is predefined text containing instructions and variable placeholders for constructing prompts for language models.
- How it is used
- Connects retrieved external context and user questions to an LLM through a repeatable LangChain chain.
- How deep it goes
- Defines placeholders and configures them with PromptTemplate, then stops short of explaining template internals.
- Examples
- Uses a New SmartX 2023 product template with context, questions, retrieved documents, and generated answers.
- What you can do after
- Apply it via LangChain to constrain product answers to retrieved context and return supporting documents.
Read how Data Storytelling with Altair and AI explains template →
The Art of AI Product Development
A prompt template is a reusable structured text pattern containing placeholders or guidance for constructing model prompts.
- How it is used
- Guides users toward supported chatbot questions and specifies an agent’s behavior, tools, memory, and task.
- How deep it goes
- Defines templates through product examples and enumerates agent instructions, but gives no implementation syntax.
- Examples
- Uses a financial-analytics chatbot and a road-mapping agent to illustrate prompt-template roles.
- What you can do after
- Build it from scratch by defining an agent’s goals, confidence policy, tools, planning, memory, and response style.
Read how The Art of AI Product Development explains template →
Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu
A template is a text pattern containing fixed content and placeholders that can be filled with variable or expression values to produce a larger string.
- How it is used
- Generates larger Terraform strings from input and bootstraps new projects from reusable boilerplate.
- How deep it goes
- Contrasts interpolation with templates and demonstrates project-template choices, but does not show Terraform template-language syntax.
- Examples
- Shows JSON and YAML encoding beside a constructed string, plus Cookiecutter-generated Terraform module files and conditional TFLint plugins.
- What you can do after
- Apply it via Cookiecutter to bootstrap a Terraform module, while choosing native encoding instead of templates for JSON or YAML.
Read how Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu explains template →
React Quickly, Second Edition
A template is a declarative document or markup structure containing placeholders or directives for generating user-interface output.
- How it is used
- Choose a React app starter that supplies a desired technology stack or initial project state.
- How deep it goes
- Compares minimal, typed, and dependency-rich starters, but does not detail how to create a custom template.
- Examples
- Compares default and minimal starters, TypeScript variants, Redux boilerplate, and a website-menu scaffold.
- What you can do after
- Operate/configure: create a React app from a named Create React App template or start from a prepared menu scaffold.
Build a Frontend Web Framework (From Scratch)
An HTML-based representation of a component’s structure that a frontend framework transforms or interprets to create its view.
- How it is used
- Defines component views and uses directives to conditionally show elements according to application state.
- How deep it goes
- Shows conditional-rendering syntax across frameworks and defers template compilation into JavaScript render functions to advanced material.
- Examples
- Compares a conditional discount paragraph in Vue, Svelte, and React.
- What you can do after
- Understand how Vue and Svelte templates and React JSX conditionally display an element.
Read how Build a Frontend Web Framework (From Scratch) explains template →
LLMs in Production
A reusable prompt structure containing instructions and variable content for directing a language model.
- How it is used
- Structures a user’s prompt with instructions and relevant context to improve the model’s chance of responding correctly.
- How deep it goes
- Explains instructions, context, and examples with a Q&A illustration, but does not provide implementation details.
- Examples
- Uses a company 401k question, retrieved policy information, and an instruction to explain the answer simply.
- What you can do after
- Build a prompt by combining a question with instructions and relevant context.
Related concepts
- Cookiecutterused by · Cookiecutter is a command-line utility that generates project files and directory structures from templates.
- WordPressused by · WordPress is an open-source content management system and publishing platform for creating, managing, and serving websites and digital content.
- promptproduces · An input, typically containing instructions or context, supplied to an artificial-intelligence model to guide or elicit its output.
- placeholderhas part · A placeholder is a temporary or symbolic stand-in for a value, content, component, or position that is supplied, replaced, or resolved later.
- Jinjaused by · Jinja is a Python templating engine that generates text by rendering templates containing static content, expressions, variables, and control structures with supplied data.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




















