Customers who viewed this item also viewed
Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the authors
OK
Prompt Engineering for LLMs: The Art and Science of Building Large Language Model-Based Applications
Purchase options and add-ons
Large language models (LLMs) are revolutionizing the world, promising to automate tasks and solve complex problems. A new generation of software applications are using these models as building blocks to unlock new potential in almost every domain, but reliably accessing these capabilities requires new skills. This book will teach you the art and science of prompt engineering-the key to unlocking the true potential of LLMs.
Industry experts John Berryman and Albert Ziegler share how to communicate effectively with AI, transforming your ideas into a language model-friendly format. By learning both the philosophical foundation and practical techniques, you'll be equipped with the knowledge and confidence to build the next generation of LLM-powered applications.
- Understand LLM architecture and learn how to best interact with it
- Design a complete prompt-crafting strategy for an application
- Gather, triage, and present context elements to make an efficient prompt
- Master specific prompt-crafting techniques like few-shot learning, chain-of-thought prompting, and RAG
- ISBN-101098156153
- ISBN-13978-1098156152
- Edition1st
- PublisherO'Reilly Media
- Publication dateDecember 31, 2024
- LanguageEnglish
- Dimensions7 x 0.59 x 9.19 inches
- Print length280 pages
Frequently bought together

Customers who viewed this item also viewed
- AI Engineering: Building Applications with Foundation ModelsPaperbackFREE Shipping by AmazonGet it as soon as Thursday, Sep 10
- Prompt Engineering for Generative AI: Future-Proof Inputs for Reliable AI OutputsPaperbackFREE Shipping by AmazonGet it as soon as Thursday, Sep 10
- Hands-On Large Language Models: Language Understanding and GenerationPaperbackFREE Shipping by AmazonGet it as soon as Thursday, Sep 10
- Build a Large Language Model (From Scratch)PaperbackFREE Shipping by AmazonGet it as soon as Thursday, Sep 10
- LLM Engineer's Handbook: Master the art of engineering large language models from concept to productionPaperbackFREE Shipping by AmazonGet it as soon as Thursday, Sep 10
- Designing Machine Learning Systems: An Iterative Process for Production-Ready ApplicationsPaperbackFREE Shipping by AmazonGet it as soon as Thursday, Sep 10
Customers also bought or read
- Prompt Engineering for Generative AI: Future-Proof Inputs for Reliable AI Outputs
Paperback$50.00$50.00FREE delivery Thu, Sep 10 - LLMs in Production: From language models to successful products
Paperback$48.13$48.13FREE delivery Thu, Sep 10 - AI Engineering: Building Applications with Foundation Models#1 Best SellerEnterprise Applications
Paperback$52.40$52.40FREE delivery Thu, Sep 10 - Building LLMs for Production: Enhancing LLM Abilities and Reliability with Prompting, Fine-Tuning, and RAG
Paperback$43.48$43.48FREE delivery Thu, Sep 10 - LLM Engineer's Handbook: Master the art of engineering large language models from concept to production
Paperback$39.99$39.99FREE delivery Thu, Sep 10 - Hands-On Large Language Models: Language Understanding and Generation
Paperback$37.68$37.68FREE delivery Thu, Sep 10 - AI Agents in Action: Build, orchestrate, and deploy autonomous multi-agent systems
Paperback$55.85$55.85$3.99 delivery Wed, Sep 23 - Building Applications with AI Agents: Designing and Implementing Multiagent Systems
Paperback$56.44$56.44FREE delivery Thu, Sep 10 - Designing Machine Learning Systems: An Iterative Process for Production-Ready Applications
Paperback$40.00$40.00FREE delivery Thu, Sep 10 - Learning LangChain: Building AI and LLM Applications with LangChain and LangGraph
Paperback$55.01$55.01FREE delivery Thu, Sep 10 - Build a Large Language Model (From Scratch)#1 Best SellerComputer Neural Networks
Paperback$49.24$49.24FREE delivery Thu, Sep 10 - Building AI Agents with LLMs, RAG, and Knowledge Graphs: A practical guide to autonomous and modern AI agents
Paperback$41.99$41.99FREE delivery Thu, Sep 10 - Designing Large Language Model Applications: A Holistic Approach to LLMs
Paperback$54.44$54.44FREE delivery Thu, Sep 10 - Building LLM Powered Applications: Create intelligent apps and agents with large language models
Paperback$39.99$39.99FREE delivery Thu, Sep 10 - Generative AI Design Patterns: Solutions to Common Challenges When Building GenAI Agents and Applications
Paperback$68.99$68.99FREE delivery Thu, Sep 10 - Generative AI with LangChain: Build production-ready LLM applications and advanced agents using Python, LangChain, and LangGraph
Paperback$41.99$41.99FREE delivery Thu, Sep 10 - Context Engineering for Multi-Agent Systems: Move beyond prompting to build a Context Engine, a transparent architecture of context and reasoning
Paperback$37.99$37.99FREE delivery Thu, Sep 10 - AI-Assisted Programming: Better Planning, Coding, Testing, and Deployment
Paperback$39.20$39.20FREE delivery Thu, Sep 10 - Designing Multi-Agent Systems: Principles, Patterns, and Implementation for AI Agents
Paperback$46.39$46.39FREE delivery Thu, Sep 10 - Unlocking Data with Generative AI and RAG: Enhance generative AI systems by integrating internal data with large language models using RAG
Paperback$44.99$44.99FREE delivery Thu, Sep 10 - Natural Language Processing with Transformers, Revised Edition
Paperback$41.60$41.60FREE delivery Thu, Sep 10 - Agentic Coding with Claude Code: The everyday developer's guide to agentic coding with Claude Code
Paperback$36.33$36.33FREE delivery Thu, Sep 10 - AI Systems Performance Engineering: Optimizing Model Training and Inference Workloads with GPUs, CUDA, and PyTorch
Paperback$71.25$71.25$3.99 delivery Sep 21 - 24 - Knowledge Graphs and LLMs in Action: Build AI systems using connected data
Paperback$55.99$55.99FREE delivery Thu, Sep 10 - LLM Design Patterns: A Practical Guide to Building Robust and Efficient AI Systems
Paperback$42.99$42.99FREE delivery Thu, Sep 10 - Generative AI with Python and PyTorch: Navigating the AI frontier with LLMs, Stable Diffusion, and next-gen AI applications
Paperback$32.99$32.99Delivery Thu, Sep 10 - The Hundred-Page Language Models Book: hands-on with PyTorch (The Hundred-Page Books)
Paperback$46.95$46.95FREE delivery Thu, Sep 10 - Agentic Design Patterns: A Hands-On Guide to Building Intelligent Systems
Paperback$35.82$35.82FREE delivery Thu, Sep 10 - Learn Model Context Protocol with Python: Build agentic systems in Python with the new standard for AI capabilities
Paperback$34.19$34.19Delivery Thu, Sep 10
From the brand
-
Browse more NLP & LLM books
-
Machine Learning, AI & more
-
More from O'Reilly
-
Sharing the knowledge of experts
O'Reilly's mission is to change the world by sharing the knowledge of innovators. For over 40 years, we've inspired companies and individuals to do new things (and do them better) by providing the skills and understanding that are necessary for success.
Our customers are hungry to build the innovations that propel the world forward. And we help them do just that.
From the Publisher
From the Preface
This book is written for application engineers. If you build software products that customers use, then this book is for you. If you build internal applications or data-processing workflows, then this book is also for you. The reason that we are being so inclusive is because we believe that the usage of LLMs will soon become ubiquitous. Even if your day-to-day work doesn’t involve prompt engineering or LLM workflow design, your codebase will be filled with usages of LLMs, and you’ll need to understand how to interact with them just to get your job done.
However, a subset of application engineers will be the dedicated LLM wranglers—these are the prompt engineers. It’s their job to convert problems into a packet of information that the LLM can understand—which we call the prompt—and then convert the LLM completions back into results that bring value to those who use the application. If this is your current role—or if you want this to be your role—then this book is especially for you.
LLMs are very approachable—you speak with them in natural language. So, for this book, you won’t be expected to know everything about machine learning. But you do need to have a good grasp of basic engineering principles—you need to know how to program and how to use an API. Another prerequisite for this book is the ability to empathize, because unlike with any technology before, you need to understand how LLMs “think” so that you can guide them to generate the content you need. This book will show you how.
What You Will Learn
The goal of this book is to equip you with all the theory, techniques, tips, and tricks you need to master prompt engineering and build successful LLM applications.
In Part I of the book, we convey a foundational understanding of LLMs, their inner workings, and their functionality as text completion engines. We cover the extension of LLMs to their new role as chat engines, and we present a high-level approach to LLM application development.
In Part II, we introduce the core techniques for prompt engineering—how to source context information, rank its importance for the task at hand, pack the prompt (without overloading it), and organize everything into a template that will result in high-quality completions that elicit the answer you need.
In Part III, we move to more advanced techniques. We assemble loops, pipelines, and workflows of LLM inference to create conversational agency and LLM-driven workflows, and we then explain techniques for evaluating LLMs.
Throughout this book, we highlight one principle that underlies all others:
If you process that statement deeply, then you’ll arrive at the same conclusions that we share throughout this book: when you want an LLM to behave a certain way, you have to shape the prompt to resemble patterns seen in training data—use clear language, rely upon existing patterns rather than creating new ones, and don’t drown the LLM in superfluous content. Once you master prompt engineering, you can build upon these skills by creating conversation agency and workflows—the dominant paradigms for LLM applications.
Editorial Reviews
About the Author
Before his work on Copilot, John built an impressive career as a search engineer. His diverse experience includes helping to develop next-generation search system for the US Patent Office, building search and recommendations for Eventbrite, and contributing to GitHub's code search infrastructure. John is also coauthor of Relevant Search (Manning), a book that distills his expertise in the field.
John's unique background, spanning both cutting-edge AI applications and foundational search technologies, positions him at the forefront of innovation in LLM applications and information retrieval.
Albert Ziegler has been designing AI-driven systems long before LLM applications became mainstream. As founding engineer for GitHub Copilot, he designed its prompt engineering system and helped inspire a wave of AI-powered tools and "Copilot" applications, shaping the future of developer assistance and LLM applications.
Today, Albert continues to push the boundaries of AI technology as Head of AI at XBOW, an AI cybersecurity company. There, he leads efforts blending large language models with cutting-edge security applications to secure the digital world of tomorrow.
Product details
- Publisher : O'Reilly Media
- Publication date : December 31, 2024
- Edition : 1st
- Language : English
- Print length : 280 pages
- ISBN-10 : 1098156153
- ISBN-13 : 978-1098156152
- Item Weight : 1.03 pounds
- Dimensions : 7 x 0.59 x 9.19 inches
- Best Sellers Rank: #101,912 in Books (See Top 100 in Books)
- #10 in Web Services
- #53 in Natural Language Processing (Books)
- #520 in Computer Science (Books)
- Customer Reviews:
About the authors

John Berryman is the founder and principal consultant of Arcturus Labs, where he specializes in LLM application development. His expertise helps businesses harness the power of advanced AI technologies. As an early engineer on GitHub Copilot, John contributed to the development of its completions and chat functionalities, working at the forefront of AI-assisted coding tools.
Before his work on Copilot, John built an impressive career as a search engineer. His diverse experience includes helping to develop next-generation search system for the US Patent Office, building search and recommendations for Eventbrite, and contributing to GitHub's code search infrastructure. John is also coauthor of Relevant Search (Manning), a book that distills his expertise in the field.
John's unique background, spanning both cutting-edge AI applications and foundational search technologies, positions him at the forefront of innovation in LLM applications and information retrieval.

Albert Ziegler has been designing AI-driven systems long before LLM applications became mainstream. As founding engineer for GitHub Copilot, he designed its prompt engineering system and helped inspire a wave of AI-powered tools and "Copilot" applications, shaping the future of developer assistance and LLM applications.
Today, Albert continues to push the boundaries of AI technology as Head of AI at XBOW, an AI cybersecurity company. There, he leads efforts blending large language models with cutting-edge security applications to secure the digital world of tomorrow.
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonTop reviews from the United States
- 5 out of 5 stars
Pragmatic, hands-on approach to learning prompt engineering
Reviewed in the United States on December 9, 2024There are, by now, quite a lot of LLM-related books to choose from, and I'm glad I got this one. It gives you a great overview of and deep dive into the necessary steps to create applications incorporating LLMs, including how to construct effective prompts and all the details that go into that, as well as how to "think like an LLM" to make use of them effectively. It also discusses tool usage and RAG, agents, as well as the all-important evals to make sure your application works, and keeps working, as expected.
It's filled with small nuggets of wisdom and insightful comments that can only come from people who've been actively applying their knowledge for years already, and I'm happy to be able to use that to get a jump-start for applying it in my own work.
6 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 4 out of 5 stars
A Clear, Insightful Guide to Becoming an LLM Whisperer
Reviewed in the United States on April 14, 2025Prompt Engineering for LLMs is a well-crafted introduction to one of the most important emerging skills in the age of AI: communicating effectively with large language models. Whether you're building LLM-powered apps or just trying to get better responses from AI, this book will help you become an LLM Whisperer.
Authors John Berryman and Albert Ziegler strike a great balance—delivering a thorough, yet not overly academic, treatment of key concepts in prompt engineering. I especially appreciated the way they frame both the philosophical underpinnings and the practical techniques. They provide a solid overview of LLM history and architecture, then dive into effective prompting strategies like few-shot learning, chain-of-thought prompting, and RAG.
The illustrations are clean and thoughtfully done—they complement the text rather than distract from it. And the book is refreshingly light on code, which makes it easier to focus on understanding the why behind prompt engineering instead of just the how.
Highly recommended for developers, tech leads, or anyone serious about tapping into the full potential of modern AI.
4 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
A fantastic read, even for seasoned prompt engineers
Reviewed in the United States on March 20, 2025I just finished reading Prompt Engineering for LLMs. The authors have done a fantastic job. I've recommended the book to a few people already. Even though my team has worked on a fair amount of LLM implementations the past two years, I found something insightful in every chapter: either some new strategy to employ or a clarifying thought about some practice I had stumbled into in prompt engineering and previously had difficulty explaining to others.
My dev team has weekly internal talks led by team members on various topics they're interested in, and I've been wanting to do more with them around AI best practices. This book is giving me a good blueprint to hopefully start that. So thank you!
2 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 2 out of 5 stars
Mostly ideas and theory not much how to
Reviewed in the United States on March 26, 2026Many things to think about, to do, conceptually, but almost nothing on how to actually do it, if you are looking for that
Sending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
Tremendous Information
Reviewed in the United States on April 15, 2026Excellent information which I will be able to use.
Sending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
Excellent Resource!
Reviewed in the United States on April 9, 2025Excellent resource! This book was incredibly helpful in growing my ability to articulate and improve my understanding of state of the art prompt engineering. I’ve recommended this book to several others and have heard similar positive reviews. Many thanks to the authors!
One person found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 2 out of 5 stars
For a Book About Prompt Engineering, There is Very Little In this Book About It
Reviewed in the United States on March 15, 2025For how much this book costs, there's not enough about actual prompt engineering in this book to justify the cost. I thought the book would cover more advanced information about building prompts, types of prompts, how to structure prompts for different types of output.
This is purportedly an advanced book about prompt engineering. There's no need for a history of LLMs. There are a multitude of books that do that already. There's only 59 pages out of close to 300 that cover actual prompting. This was a disppontment.
25 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
Why Prompt Engineering Belongs in Every Developer’s Toolkit
Reviewed in the United States on May 4, 2025Prompt Engineering for LLMs: The Art and Science of Building Large Language Model-Based Applications is a practical, insightful guide that meets software engineers exactly where they are; at the crossroads of traditional development and the fast-evolving world of AI integration. As large language models become embedded in both customer-facing products and internal systems, the ability to work fluently with them is quickly becoming a fundamental engineering skill. This book makes the case for that future and it provides a path to get there.
John Berryman and Albert Ziegler succeed not just in defining what prompt engineering is, but in teaching how to do it well. They present prompt engineering as both a science and an art, rooted in clear communication, structured thinking, and a deep understanding of how LLMs interpret and respond to language. The book moves fluently from foundational concepts to advanced techniques like retrieval-augmented generation, looped inference workflows, and conversational agency design. Whether you’re optimizing prompts for performance or architecting entire LLM-based systems, the material is grounded, accessible, and deeply applicable.
Perhaps most importantly, this book reflects a truth too often overlooked: prompt engineering isn’t a fringe specialization / job (as is being shown by that job currently going out of fashion at the time of writing). It’s becoming a core competency in software development. If you’re already building applications, or expect to in a world increasingly shaped by AI, this is a book you should take a strong look at.
2 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Top reviews from other countries
ARG5 out of 5 starsLearning the Fundamentals
Reviewed in Germany on May 16, 2026An insightful and comprehensive introduction to building applications using foundation models.
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Computational Scientist5 out of 5 starsLearn why prompts work on a fundamental level.
Reviewed in the United Kingdom on December 7, 2025I was a bit skeptical of this book when ordering, but it really impressed me. It doesn't give many concrete examples, but rather talks about how prompts work in relation to an AI's training data and how you can leverage knowledge you have of that to get the best performance from an LLM. There's lots of scenarios and lots of contingencies. Has helped me a lot when writing props for agents.
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Mr. T. Pickering5 out of 5 starsExcellent - clear and comprehensive.
Reviewed in Canada on April 10, 2026Comprehensive and very clear. You will end up with deep knowledge on the topic - and very much more efficient at your day job.
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Damyan Dimitrov3 out of 5 starsNot so much examples
Reviewed in Germany on September 27, 2025I neither liked the book nor disliked it. I didn't like that there weren't enough real examples and comparisons of prompts.
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
chris4 out of 5 starsExcellent resource on LLM concepts and prompt engineering
Reviewed in the United Kingdom on September 30, 2025This book manages to include enough technical detail and principles to make it interesting and usable for developers, while also distilling more complex topics for all tech enthusiasts to understand and enjoy.
I particularly enjoyed the tips throughout the book and diagrams that I will surely revisit.
To list some of the concepts covered in this book:
- Transformer architecture / LLM history
- Little Red Hiding Hood principle
- Zero-shot, few-shot and chain-of-thought prompting
- Elastic snippets
- logprobs
- ReAct
- Tools
- Offline and online evaluation
And much, much more.
Highly recommended!
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again


















