The Art and Science of Building Large Language Model–Based Applications
John Berryman, Albert Ziegler

#LLM
#RAG
#AI
مدلهای زبانی بزرگ (LLMها) در حال دگرگونسازی جهان هستند و نوید خودکارسازی وظایف و حل مسائل پیچیده را میدهند. نسل جدیدی از نرمافزارها از این مدلها بهعنوان اجزای اصلی استفاده میکنند تا در تقریباً تمام حوزهها ظرفیتهای جدیدی را آزاد کنند؛ اما دسترسی پایدار و مؤثر به این تواناییها، نیازمند مهارتهای تازهای است.
این کتاب، هنر و علم «مهندسی پرامپت» (Prompt Engineering) را به شما میآموزد — کلیدی برای آزادسازی توان واقعی مدلهای زبانی بزرگ.
کارشناسان صنعت، جان بریمن (John Berryman) و آلبرت زیگلر (Albert Ziegler)، روشهای مؤثر برقراری ارتباط با هوش مصنوعی را آموزش میدهند و نشان میدهند چگونه ایدههای خود را به قالبی قابلدرک برای مدلهای زبانی تبدیل کنید. با یادگیری همزمان مبانی فلسفی و تکنیکهای عملی، شما به دانشی مجهز میشوید که برای ساخت نسل آینده برنامههای مبتنی بر LLM به آن نیاز دارید.
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.
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.
Table of Contents
Part I. Foundations
Chapter 1. Introduction to Prompt Engineering
Chapter 2. Understanding LLMs
Chapter 3. Moving to Chat
Chapter 4. Designing LLM Applications
Part II. Core Techniques
Chapter 5. Prompt Content
Chapter 6. Assembling the Prompt
Chapter 7. Taming the Model
Part III. An Expert of the Craft
Chapter 8. Conversational Agency
Chapter 9. LLM Workflows
Chapter 10. Evaluating LLM Applications
Chapter 11. Looking Ahead
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.









