This book is licensed for the personal use of the buyer. Please do not share or resell the file. Short quotations with attribution are welcome.
The information in this book is provided for education. It is not legal, financial or other professional advice. Product and company names are used only to describe them and belong to their owners.
This is a free sample: the introduction and first chapter.
IntroductionIntroduction
Building software with large language models is different from traditional programming. The core component is probabilistic: the same input can produce different outputs, quality is measured statistically, and behaviour is shaped by prompts and data as much as by code. Yet the engineering disciplines still apply: clear interfaces, testing, observability, security, cost control and incremental delivery.
This book is for software developers who want to build reliable AI features. It is vendor-neutral: examples use simplified pseudo-code and common patterns found across model providers. It covers calling models, prompt design for applications, structured outputs, tool use, retrieval-augmented generation, agents, evaluation, observability, security, cost and using AI coding assistants well.
How the book is organised
Chapters 1 to 10: foundations: models, tokens, APIs and choosing models.
Chapters 11 to 22: prompts, structured output, tool calling and streaming.
Chapters 23 to 34: retrieval-augmented generation.
Chapters 35 to 46: agents and workflows.
Chapters 47 to 58: evaluation, testing and observability.
Chapters 59 to 66: security, deployment and cost.
Chapters 67 to 68: two worked examples, end to end.
Chapters 69 to 72: coding assistants and a production readiness checklist.
Chapter 1The Developer's Mental Model
A language model takes text (and sometimes images or audio) as input and produces text as output. Your application builds the input (instructions, context, user message), calls the model, parses the output, and acts on it. Everything around the model call is ordinary software engineering.
You have reached the end of the free sample. The full book continues with 71 more chapters, plus the appendices.