liveBook · Manning

Prompt engineering

Prompt engineering is the deliberate design and refinement of instructions, context, examples, or other inputs to guide an AI model’s behavior or outputs.

How 38 Manning books explain it

Introduction to Generative AI, Second Edition

Prompt engineering is the deliberate design of inputs to guide a generative model's behavior or output.

How it is used
Guides generative model responses toward a task’s intended audience, format, and purpose without retraining the model.
How deep it goes
Develops practical strategies and a draft-test-evaluate-revise process, while acknowledging that prompt effects remain imperfectly understood.
Examples
Uses an executive-summary request, challenge-specific sample prompts, and a chatbot whose answers become too long or too short.
What you can do after
Practice/perform prompt design by testing revisions against representative requests and evaluating whether responses meet the intended goal.

Read how Introduction to Generative AI, Second Edition explains prompt engineering →

Coding with AI

Prompt engineering is the systematic design and refinement of instructions and context provided to an AI system to elicit desired outputs.

How it is used
Guides AI coding assistants toward clearer code, documents, designs, requirements, and tests.
How deep it goes
Explains prompt components, types, refinement, decomposition, and iterative evaluation without guaranteeing model correctness.
Examples
Demonstrates HAM radio quiz design, email validation, discount calculation, HTTP requests, and iterative multiplication prompts.
What you can do after
Apply it via AI coding tools to specify outputs, refine responses, and review generated work critically.

Read how Coding with AI explains prompt engineering →

LLMs in Production

Prompt engineering is the practice of designing and refining input instructions to influence an AI model's behavior and output.

How it is used
Guides a general-purpose language model toward useful, consistent responses in applications without retraining it for every task.
How deep it goes
Defines prompts and engineering, gives practical strategies and production failure cases, and demonstrates evaluated optimization rather than promising reliable outputs.
Examples
Uses translation and summarization requests, a coding copilot’s input mismatch, and a DSPy grade-school math evaluation.
What you can do after
Apply it via DSPy to optimize and evaluate a math prompt, or refine application prompts against realistic user inputs.

Read how LLMs in Production explains prompt engineering →

AI for Everyday IT

Prompt engineering is the deliberate design and refinement of instructions supplied to an AI system to improve the quality or relevance of its responses.

How it is used
Improves AI interactions by shaping requests for practical content creation, learning, analysis, and problem-solving.
How deep it goes
Explains construction principles, prompting modes, advanced techniques, iteration, and limitations without covering model internals.
Examples
Uses database comparisons, IT-ticket classification, ESL tutoring, project-management advice, and Oracle-to-SQL Server conversion prompts.
What you can do after
Apply it via AI chatbots to create clearer requests, iterate on responses, and produce more actionable work outputs.

Read how AI for Everyday IT explains prompt engineering →

Generative AI in Action

Prompt engineering is the deliberate design and refinement of inputs provided to generative models to elicit desired outputs.

How it is used
Steers generative models toward task-specific outputs in enterprise applications.
How deep it goes
Develops prompt components, iterative refinement, examples, best practices, and operational risks without a mathematical derivation.
Examples
Uses revised sales-analysis and code-documentation requests, a GPT-3.5 arithmetic prompt, and contrasting image-style prompts.
What you can do after
Practice/perform iterative prompt design by evaluating responses and refining instructions, examples, and context.

Read how Generative AI in Action explains prompt engineering →

Knowledge Graphs and LLMs in Action

Prompt engineering is the deliberate design and iterative refinement of instructions and examples given to a language model to obtain desired outputs.

How it is used
Deploys natural-language instructions and examples to extract domain-specific entities and relations for knowledge graphs.
How deep it goes
Explains iterative design, class naming, examples, configuration, and failure modes, but defers model internals and detailed fine-tuning.
Examples
Demonstrates diary-entry extraction, abbreviated names and titles, normalized relations, OpenAI API calls, and chain-of-thought prompting.
What you can do after
Build it from scratch by iterating prompts, selecting examples and parameters, and evaluating structured LLM outputs for a domain task.

Read how Knowledge Graphs and LLMs in Action explains prompt engineering →

Natural Language Processing in Action, Second Edition

Prompt engineering is the deliberate design and revision of prompts to influence a language model's behavior and outputs.

How it is used
Shapes chatbot dialogue and illustrates why prompt wording alone cannot ensure reliable behavior.
How deep it goes
Works through prompt-template revisions and observed replies, then contrasts prompting with classification rather than specifying a universal prompt recipe.
Examples
Uses a parental-consent tutor chatbot, a number-sequence quiz, and prompts for detecting unusual requests.
What you can do after
Apply it via LangChain prompt templates to revise chatbot responses, while testing outputs and reserving classification for routing decisions.

Read how Natural Language Processing in Action, Second Edition explains prompt engineering →

The Art of AI Product Development

Prompt engineering is the deliberate design and refinement of instructions provided to a generative model to elicit desired outputs.

How it is used
Steers language-model outputs toward application tasks and user needs without changing model weights.
How deep it goes
Develops a practical progression from zero-shot prompts to examples, reasoning prompts, evaluation, templates, and version control rather than model internals.
Examples
Uses client blog-post tone instructions, content-app prompt management, and conversational versus graphical interfaces.
What you can do after
Practice/perform iterative prompt design, compare outputs, and manage revisions collaboratively as an application matures.

Read how The Art of AI Product Development explains prompt engineering →

Building LLM Applications with DSPy

The practice of manually iterating on and rephrasing prompts to improve language-model responses.

How it is used
Tunes language-model requests manually when application responses need to be more reliable.
How deep it goes
Defines the iterative practice, identifies editable prompt sections and heuristics, and explains testing difficulties without prescribing a guaranteed formula.
Examples
Uses a customer-intent classifier with allowed labels, a JSON output format, and a labeled demonstration.
What you can do after
Practice/perform prompt revisions and test their results, while recognizing when automated optimization may reduce manual search.

Read how Building LLM Applications with DSPy explains prompt engineering →

Software Testing with Generative AI

Prompt engineering is the deliberate design of inputs, instructions, constraints, and examples to influence a large language model toward a desired output.

How it is used
Applies deliberate prompt patterns to testing, development feedback, test-case creation, and synthetic-data generation.
How deep it goes
Explains prompt construction through constraints, delimiters, examples, decomposition, and evaluation, while stopping short of eliminating model errors.
Examples
Demonstrates Contact Us risk prompts, authorization API test cases, simulated rubber-duck feedback, and delimited room-data schemas.
What you can do after
Apply prompt tactics to formulate specific testing tasks and obtain more structured, context-relevant LLM assistance for human review.

Read how Software Testing with Generative AI explains prompt engineering →

Grokking AI Applications

Prompt engineering is the systematic design and refinement of prompts to influence a generative model's outputs.

How it is used
Guides LLM behavior toward the tone, style, objectives, and outputs required by a GenAI application.
How deep it goes
Explains prompt structure, length, context, hallucinations, templates, and experimentation without descending into model internals.
Examples
Uses a thoughtful-daughter template and visual examples organized around roles, tasks, features, and examples.
What you can do after
Apply iterative prompt design to produce clearer, more useful, and better-aligned LLM responses.

Read how Grokking AI Applications explains prompt engineering →

Starting Data Analytics with Generative AI and Python

Prompt engineering is the deliberate design and refinement of instructions supplied to a generative AI system.

How it is used
Uses prompt engineering to steer generative AI toward a specific analytical problem and reduce irrelevant or overgeneralized answers.
How deep it goes
Defines ordinary prompt direction through context, audience, format, and follow-up; distinguishes scientific response-testing as a niche meaning without developing it.
Examples
Illustrates audience changes with linear regression and targeted error questioning with Portuguese review tokenization.
What you can do after
Practice/perform it by adding context and output requirements, then questioning specific weaknesses and inspecting revised answers or code.

Read how Starting Data Analytics with Generative AI and Python explains prompt engineering →

Machine Learning Platform Engineering

Prompt engineering is the deliberate design and refinement of inputs provided to generative models to influence their outputs.

How it is used
Guides documentation-assistant responses and query routing by shaping instructions, examples, and retrieved context.
How deep it goes
Explains versioned prompt management and token-saving revisions, but does not specify a complete prompt-testing implementation.
Examples
Compares verbose and concise documentation prompts and uses a minimal complexity-classification prompt for model routing.
What you can do after
Apply it via Langfuse to version and compare prompts, then refine token use without sacrificing quality.

Read how Machine Learning Platform Engineering explains prompt engineering →

Prompt Engineering in Practice

The deliberate construction of a prompt's instructions, context, constraints, and output requirements.

How it is used
Makes language-model prompts reliable, reviewable interfaces for software products, workflows, and shared prompt libraries.
How deep it goes
Defines the practice and lays out composition, testing, iteration, and management; stops short of changing model weights.
Examples
Uses a pull-request summary, an API migration notice, and revisions of architecture-diagram and ADR-summary prompts.
What you can do after
Build it from scratch as a testable prompt contract, then refine failures and maintain its change history.

Read how Prompt Engineering in Practice explains prompt engineering →

AI Agents and Applications

Prompt design is the practice of formulating instructions and context to influence a language model's behavior and output.

How it is used
Guides model behavior in chatbots, research summarization, and agent routing through task-specific instructions and context.
How deep it goes
Defines the practice and develops reusable templates, examples, and task-specific prompts; identifies retrieval as a remedy when prompts lack needed facts.
Examples
Uses chatbot role instructions, research-query and report prompts, and specialist-agent routing criteria as concrete applications.
What you can do after
Practice/perform prompt design by writing, testing, and refining reusable instructions for specific LLM tasks.

Read how AI Agents and Applications explains prompt engineering →

AI Agents in Action

Prompt engineering is the deliberate design and refinement of inputs to a language model to obtain desired and consistent outputs.

How it is used
Guides direct LLM interaction and the design, refinement, and evaluation of prompts supporting agents and assistants.
How deep it goes
Descends from clear-instruction tactics through system prompts, reasoning, planning, and rubric evaluation, while noting that the field lacks settled methodology.
Examples
Uses ChatGPT recommendation prompts, system messages, a Python prompt tester, time-travel problems, and rubric-scored prompt variants.
What you can do after
Apply it via ChatGPT, Python LLM integrations, or prompt flow to craft, iterate, compare, and evaluate prompts.

Read how AI Agents in Action explains prompt engineering →

Effective Data Analysis

Prompt engineering is the practice of designing and refining instructions supplied to generative models to obtain desired outputs.

How it is used
Supports analytics, software integration, internal efficiency, and stakeholder-facing use of generative AI.
How deep it goes
Explains iterative prompt design, model review, output constraints, and evaluation, but does not detail model internals or fine-tuning.
Examples
Uses customer-login statistics, support-text summaries, rat-sighting analysis, predictive models, Python code, and agency recommendations.
What you can do after
Apply prompt refinement to request analyses, code, metrics, models, and constrained stakeholder recommendations from chatbots.

Read how Effective Data Analysis explains prompt engineering →

Deep Learning with JAX

The practice of shaping input prompts to get better outputs from a pretrained language model without changing its weights.

How it is used
Uses structured input text to steer pretrained language models toward desired task outputs.
How deep it goes
Defines prompt structuring and names chain of thought, but defers detailed techniques and implementation.
Examples
Uses a GPT-J prompt that requests SQL from natural language enclosed in triple backticks.
What you can do after
Evaluate generated outputs for formatting, multiplicity, repetition, and syntax errors before using them.

Read how Deep Learning with JAX explains prompt engineering →

How Large Language Models Work

Prompt engineering is the practice of designing and modifying input text to influence a language model's behavior or output.

How it is used
Constrains an instruction-following LLM to a task, goal, detail level, or tone through carefully designed input text.
How deep it goes
Defines prompts, demonstrates modifications, and explains brittleness, while stopping short of a procedural optimization method.
Examples
Uses car-selling bots, CSV formatting, survey-theme summarization, and question rewriting for search.
What you can do after
Apply explicit prompts to repetitive, fuzzy tasks while testing results rather than treating fluent output as guaranteed accuracy.

Read how How Large Language Models Work explains prompt engineering →

Financial AI in Practice

Prompt engineering is the deliberate design and refinement of instructions supplied to generative models to elicit desired outputs.

How it is used
Guides LLMs to turn retrieved financial information into a premium digest or structured, auditable news signals.
How deep it goes
Works through role, evidence boundaries, two-stage context, JSON fields, and response validation; leaves production retrieval beyond the digest snippet.
Examples
Uses a personalized investment-post digest, a two-stage uranium-news analyst prompt, and a fraud-guidelines query.
What you can do after
Apply it via the OpenAI Responses API to produce validated, structured signals from supplied news context.

Read how Financial AI in Practice explains prompt engineering →

AI-Powered Search

Prompt engineering is the deliberate design and manipulation of model inputs to influence the behavior or output of a language model.

How it is used
Guides language models toward task-specific search outputs by injecting context into each inference request.
How deep it goes
Explains context steering and DSPy-based optimization, then stops short of model-weight training internals.
Examples
Uses unicorn queries, role-and-expertise context, DSPy signatures, evaluation metrics, and tracked prompt responses.
What you can do after
Evaluate and optimize prompts using task signatures, response metrics, tracked outputs, and automated prompt-variation testing.

Read how AI-Powered Search explains prompt engineering →

Effective Conversational AI

Prompt engineering is the design of instructions, context, examples, and input data supplied to a language model to influence its output.

How it is used
Guides language-model outputs for conversational answers and generates candidate utterance variants for chatbot coverage.
How deep it goes
Defines prompt components and works through iterative synonym requests, without detailing model internals.
Examples
Contrasts generic and customer-contextualized prompts for synonyms of “password” and “forgot.”
What you can do after
Practice/perform iterative prompt revision and test changes against logged user requests and updated test sets.

Read how Effective Conversational AI explains prompt engineering →

The AI Pocket Book

The practice of designing prompts to steer a language model toward better or more reliable outputs.

How it is used
Improves off-the-shelf generative AI outputs, including hallucination mitigation, task customization, and output disambiguation.
How deep it goes
Demonstrates few-shot and chain-of-thought prompting, then compares prompting with fine-tuning without detailing model internals.
Examples
Uses arithmetic word problems, world-record tables, RAG context, and Midjourney image references as concrete examples.
What you can do after
Apply prompting through demonstrations, reasoning examples, retrieved context, and reference images before attempting fine-tuning.

Read how The AI Pocket Book explains prompt engineering →

Deep Learning with R, Third Edition

Prompt engineering is the systematic design and refinement of inputs to a generative model to improve its performance on a task.

How it is used
Improves language-model performance by shaping prompts for particular outputs, roles, constraints, or reasoning tasks.
How deep it goes
Explains prompt construction through continuations, role instructions, constraints, and phrasing sensitivity, but does not provide a formal optimization procedure.
Examples
Uses brownie recipes, role instructions, harmful-topic constraints, reasoning riddles, and an invented-president question to demonstrate prompt effects.
What you can do after
Apply prompt engineering by constructing contextual openings, role instructions, constraints, and wording variations for language-model tasks.

Read how Deep Learning with R, Third Edition explains prompt engineering →

AI-Powered Developer: Build software with ChatGPT and Copilot

Prompt engineering is the deliberate design and iterative refinement of instructions given to an AI model to influence its outputs.

How it is used
Guides LLMs toward targeted code, designs, and explanations by improving task instructions over successive interactions.
How deep it goes
Defines refinement and persona patterns, then demonstrates them through linked-list, system-design, and code-generation prompts.
Examples
Uses singly linked lists, an IT asset management system, and depreciation strategies to demonstrate prompt refinement.
What you can do after
Apply it via ChatGPT or GitHub Copilot to specify requirements, refine generated code, and check outputs against intended rules.

Read how AI-Powered Developer: Build software with ChatGPT and Copilot explains prompt engineering →

Building Reliable AI Systems

The deliberate design of instructions and context to guide a language model's behavior and outputs.

How it is used
Uses prompt design as the first, fast intervention for improving LLM response reliability before adding retrieval or fine-tuning.
How deep it goes
Develops an iterative workflow with examples, reasoning prompts, generation settings, testing, and production versioning; defers fresh factual grounding to retrieval.
Examples
Uses an e-commerce chatbot’s tone, changing inventory, a legal assistant’s vague instructions, and a Python prompt-version registry.
What you can do after
Practice/perform prompt revision against real queries, then choose retrieval or fine-tuning when prompts do not meet the quality bar.

Read how Building Reliable AI Systems explains prompt engineering →

The Complete Obsolete Guide to Generative AI

Prompt engineering is the deliberate design and refinement of instructions and context supplied to a generative model to influence the quality of its output.

How it is used
Guides language-model responses toward task-specific formats, context, constraints, and desired results.
How deep it goes
Explains practical prompt strategies and iterative refinement, without descending into language-model internals.
Examples
Uses investment-counselor roles, CSV output, Python loop questions, error messages, car descriptions, and 4K video conversion.
What you can do after
Apply it via ChatGPT to ask focused questions, refine weak responses, and troubleshoot generated code.

Read how The Complete Obsolete Guide to Generative AI explains prompt engineering →

Build AI-Enhanced Web Apps

Prompt engineering is the design and refinement of instructions and contextual information supplied to an AI model to guide its outputs.

How it is used
Optimizes AI-generated outputs and user interactions by tailoring instructions and context to web-application requirements.
How deep it goes
Explains strategies, prompt types, structured-output techniques, token limits, and versioning, but does not descend into model internals.
Examples
Uses structured JSON generation, few-shot task adaptation, semantic search, content recommendations, and interview feedback.
What you can do after
Apply it to improve accuracy, contextual relevance, structured output reliability, and user experience in AI-powered web applications.

Read how Build AI-Enhanced Web Apps explains prompt engineering →

Data Analysis with LLMs

Prompt engineering is the systematic design and search of prompts or prompt templates to guide a language model toward better task results.

How it is used
Guides language models toward better task results through deliberate prompt and prompt-template design.
How deep it goes
Explains task specification, contextual prompting, template experimentation, and few-shot examples without detailing model internals.
Examples
Uses sentiment classification, labeled reviews, constrained positive-or-negative answers, and alternative prompt templates.
What you can do after
Build it from scratch by designing and testing prompt templates for familiar or novel language-model tasks.

Read how Data Analysis with LLMs explains prompt engineering →

AI Agents in Action, Second Edition

Prompt engineering is the deliberate design and refinement of instructions and contextual input to elicit desired behavior from a language model.

How it is used
Shapes agent personas, reasoning, workflows, tool use, and response constraints for predictable task completion.
How deep it goes
Moves from instruction principles to complete workflows, examples, constraints, typed outputs, and tracing, while deferring deep model internals.
Examples
Uses a search-agent workflow, source-selection examples, typed research plans, strict length limits, tool calls, repeated runs, and trace inspection.
What you can do after
Apply it via the OpenAI Agents SDK to refine prompts, enforce structured results, add tools, and inspect execution traces.

Read how AI Agents in Action, Second Edition explains prompt engineering →

Learn AI-Assisted Python Programming, Second Edition

The practice of designing and refining instructions for an AI system to improve the relevance and correctness of its outputs.

How it is used
Improves AI-assisted programming by shaping requests, correcting generated code, and eliciting useful explanations.
How deep it goes
Explains precision, testing, and prompt revision procedurally, while deferring detailed prompt patterns beyond function requests and explanation requests.
Examples
Uses function headers, docstrings, rewritten function prompts, /explain, and line-by-line explanation requests.
What you can do after
Diagnose/debug with it by testing Copilot output, identifying errors, and revising prompts to seek better code or explanations.

Read how Learn AI-Assisted Python Programming, Second Edition explains prompt engineering →

Transformers in Action

Prompting is the practice of providing input instructions or context to a generative model to elicit a desired output.

How it is used
Guides generative models toward task-specific outputs through crafted inputs.
How deep it goes
Defines prompts, compares prompting patterns, and gives few-shot and thread-of-thought procedures without detailing model internals.
Examples
Uses few-shot sentiment classification and a SuperGLUE comparison of zero-shot and few-shot performance.
What you can do after
Practice/perform it by supplying task examples or staging a reasoning prompt for a chaotic context.

Read how Transformers in Action explains prompt engineering →

Deep Learning with Python, Third Edition

The practice of crafting prompts to elicit better performance from a large language model on a task.

How it is used
Improves large language model performance by formulating prompts for particular tasks.
How deep it goes
Defines phrasing sensitivity, gives a riddle and instruction example, and stops short of a systematic prompt-design procedure.
Examples
Uses the Alice riddle, altered variable values, step-by-step instructions, and Python list sorting with a requested style.
What you can do after
Apply it via deliberate prompt variation and explicit instructions to improve task performance and test reliability.

Read how Deep Learning with Python, Third Edition explains prompt engineering →

Build an AI Agent (From Scratch)

Prompt engineering is the practice of designing prompts and instructions to elicit accurate or appropriately formatted outputs from a language model.

How it is used
Directs a general-purpose LLM to behave consistently as an agent across changing user requests.
How deep it goes
Defines user and system prompts and gives actionable agent guidelines, without showing implementation code in the supplied excerpts.
Examples
Uses a weather request and sample system-prompt instructions to contrast immediate search with unnecessary confirmation.
What you can do after
Apply it via system prompts to direct immediate action, minimal clarification, and proactive tool use.

Read how Build an AI Agent (From Scratch) explains prompt engineering →

Build Financial Software with Generative AI (From Scratch)

Prompt engineering is the practice of designing clear, specific inputs that guide a language model toward useful responses.

How it is used
Guides requests to generative AI when developing and refining software requirements.
How deep it goes
Defines core prompt qualities and demonstrates iterative code refinement, but does not detail individual prompting techniques.
Examples
Uses ChatGPT-generated Python for reading, formatting, and returning a financial balance.
What you can do after
Apply it via ChatGPT to express software requirements and iteratively improve generated code.

Read how Build Financial Software with Generative AI (From Scratch) explains prompt engineering →

Investing for Programmers

Prompt engineering is the practice of designing and refining instructions and contextual inputs to obtain more useful outputs from an AI system.

How it is used
Improves LLM queries for financial research, especially due diligence and company scorecards.
How deep it goes
Defines specificity, context, examples, and investor profiles but stops short of a formal optimization workflow.
Examples
Uses investor profiles, company-management questions, and detailed investment inquiries instead of generic stock recommendations.
What you can do after
Apply it via detailed prompts that include goals, risk tolerance, tax residency, context, and reference examples.

Read how Investing for Programmers explains prompt engineering →

WordPress Power Toolkit: Harness AI to build next-level websites

Prompt engineering is the practice of designing and refining instructions supplied to an AI system to influence its behavior and outputs.

How it is used
Improves AI requests for website planning, WordPress resource discovery, writing revision, and other multi-step tasks.
How deep it goes
Demonstrates combined techniques through complete prompts and iterative refinement, but notes that systems may not follow pause-and-wait instructions.
Examples
Uses Instant Pot website planning, WordPress resource selection, Claude prompt generation, and prose revision in a simple, clear style.
What you can do after
Apply it via Claude’s Generate a Prompt feature, then edit and test expanded instructions for a specific task.

Read how WordPress Power Toolkit: Harness AI to build next-level websites explains prompt engineering →

Optimization Algorithms: AI techniques for design, planning, and control problems

An optimization approach that describes an optimization task in natural language and prompts a large language model to generate improved solutions or instructions.

How it is used
Uses natural-language descriptions of optimization tasks to enlist large language models as optimizers.
How deep it goes
Defines OPRO as simple and effective but does not provide implementation steps, parameters, or algorithmic internals.
Examples
Names maximum coverage, MaxCut, minimum vertex cover, SAT, TSP, and vehicle routing as application problems.
What you can do after
Evaluate natural-language optimization as an emerging machine-learning approach across benchmark optimization problems.

Read how Optimization Algorithms: AI techniques for design, planning, and control problems explains prompt engineering →

Related concepts

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.