Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Richard Davies, Rafael Fischer

Write, refine, organize, and optimize AI prompts that generate relevant and useful text and images! Generative AI models such as ChatGPT, Stable Diffusion, and Gemini can produce amazingly “human-like” news articles, document summaries, images, computer code, and more—if you know how to write effective prompts. This book will teach you the prompt design and authoring skills you need to get useful and relevant responses from AI models, along with advanced prompting techniques for Retrieval Augmented Generation (RAG), building autonomous agents, and data privacy. AI Engineering in Practice teaches you how to: Design prompts that generate accurate and readable responses from LLMs Mitigate hallucinations in LLM output Domain-aware content generation using RAG How AI model design affects your prompts Evaluate, optimize, and organize your prompts Prompt engineering is the discipline of writing instructions for AI models to generate relevant, accurate, and usable completions. AI Engineering in Practice shows you how to engineer prompts that ensure the outputs of LLMs and other generative AI models exactly match your requirements. You’ll learn how to structure your objectives, take advantage of contextual details, and even pick the right model for your task. about the reader No special skills with AI or machine learning required. Code examples are in Python.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical field guide to turning ad-hoc prompting into dependable production systems: it teaches prompt design, RAG grounding, routing, validation, and agent architectures for anyone building real applications on LLMs. Best for developers, product engineers, and technical leads who need reliability, cost control, and measurable quality—not just clever one-off prompts. 【Book Arc】 - **Opening (~0%–10%)**: Frames the core problem—ad-hoc prompting collapses at production scale—using contrasting cases (a hallucinating airline chatbot vs. a high-volume engineered assistant) and introduces the five-layer blueprint: routing, RAG, prompting, validation, and integration. - **Early (~10%–28%)**: Walks through a single customer transaction to show how the layers interact, then pivots to foundation-model fundamentals: why they are called foundation models, their applications, and the architectural logic behind reliable systems. - **Middle (~28%–47%)**: Explains how models are built and behave—data collection and preprocessing, Transformer self-attention, training objectives, instruction fine-tuning, evaluation methods (perplexity, human ratings, benchmarks), and inference-time generation controls. - **Late (~47%–60%)**: Covers distribution and operational trade-offs: commercial APIs vs. open-source deployment, quantization, inference engines, LoRA fine-tuning, token costs, latency, observability, and security risks like prompt injection. - **Ending (~60%+ of indexed excerpts)**: The excerpts do not cover the later chapters in detail; the book's stated structure promises advanced material on chaining prompts into workflows, intelligent routing, RAG implementation, autonomous agents, and operational practices. 【Key Takeaways】 - **Production reliability comes from layered defenses, not better prompts alone** (Opening): routing, RAG grounding, validation, and integration convert isolated model calls into dependable systems. - **The demo-to-production gap is an engineering problem** (Opening): single-case success fails at scale, exposing edge cases, context limits, cost explosions, and security vulnerabilities invisible in testing. - **Prompt routing is a major cost lever** (Early): classifying query complexity and sending simple requests to lightweight models can cut monthly API bills dramatically compared to sending everything to premium models. - **RAG grounds responses in verified knowledge** (Early): vector databases retrieve semantically relevant documents—not just keyword matches—and inject them as authoritative context, sharply reducing hallucinations. - **Foundation models are general-purpose bases, not task-specific tools** (Early): a single pretrained model can be specialized, extended, or prompted into many different applications without starting from scratch. - **Model behavior is shaped by training and inference choices** (Middle): data quality, architecture, context length, parameter count, token budget, and generation parameters all affect what you get back. - **Evaluation needs multiple methods** (Middle): perplexity catches regressions, human ratings guide quality, and benchmarks like HELM and MMLU compare models across domains. - **Deployment involves real trade-offs** (Late): APIs offer ease and state-of-the-art access; open-source models offer control at the cost of complexity, with quantization, inference engines, and observability tools as key operational concerns. 【Reading Tips】 - **Deep-read the opening chapter**: the five-layer blueprint and the transaction walkthrough are the mental model for everything that follows—skim later if you already know foundation-model basics. - **Skim the model-fundamentals chapter if you have ML background**: the training, preprocessing, and Transformer material is useful context but not the book's core value. - **Treat the architecture layers as a checklist**: as you read, map each technique (routing, RAG, validation, integration) to your own system's weak points. - **Pay attention to cost and latency examples**: the routing math and operational trade-offs are where engineering discipline translates into real savings. - **Note the Python code examples**: the book assumes no AI/ML expertise, so hands-on readers can follow along without special setup. 【Coverage Limits】 This guide is based on stratified excerpts covering roughly the first half of the book; the later chapters on RAG implementation, autonomous agents, and advanced operational practices are referenced but not detailed in the available material.
Page 4
ut of this book, you should have a general understanding of computer usage and be familiar with the concept of artificial intelligence. Previous programming...
View in text
Page 19
rst hits the intelligent router, which analyzes the text to classify it as a PAYMENT_ISSUE with COMPLEX difficulty. This classification determines routing; t...
View in text
Excerpt 3
er prompts, avoid common pitfalls, and build smarter tools. You don’t need a PhD in machine learning. But knowing the building blocks will make you a more po...
View in text
Excerpt 4
requirements, making it easier to run on smaller hardware. To serve models efficiently in production, developers rely on optimized inference engines like vLL...
View in text
Excerpt 5
elf. To build reliable applications, developers must manage operational constraints like token limits, computational costs, and the model's lack of real-time...
View in text
Excerpt 6
rn to request a news article about a recent political event. Include an appropriate indicator (e.g., “News Article:”) to instruct the model to start its stru...
View in text
Excerpt 7
ty and effectiveness of this combination therapy in humans. Significance: This groundbreaking study offers hope for Alzheimer's patients, potentially providi...
View in text
Excerpt 8
ack Friday Upgrade"). The generic approach uses predictable promotional language that lacks strategic insight about what drives email engagement. Notice how...
View in text
Tags
AI categories
Artificial IntelligenceAISoftware
Publish Year: 2025
Language: English
Pages: 152
File Format: PDF
File Size: 1.7 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…