Foreword xi
Preface xiii
Acknowledgments xix
About the Author xxi
Part I: Introduction to Large Language Models 1
Chapter 1: Overview of Large Language Models 3
What Are Large Language Models? 4
Popular Modern LLMs 7
Applications of LLMs 25
Summary 31
Chapter 2: Semantic Search with LLMs 33
Introduction 33
The Task 34
Solution Overview 36
The Components 37
Putting It All Together 53
The Cost of Closed-Source Components 57
Summary 58
Chapter 3: First Steps with Prompt Engineering 59
Introduction 59
Prompt Engineering 59
Working with Prompts Across Models 70
Summary 74
Chapter 4: The AI Ecosystem: Putting the Pieces Together 75
Introduction 75
The Ever-Shifting Performance of Closed-Source AI 76
AI Reasoning versus Thinking 77
Case Study 1: Retrieval Augmented Generation 79
Case Study 2: Automated AI Agents 87
Conclusion 93
Part II: Getting the Most Out of LLMs 95
Chapter 5: Optimizing LLMs with Customized Fine-Tuning 97
Introduction 97
Transfer Learning and Fine-Tuning: A Primer 99
A Look at the OpenAI Fine-Tuning API 102
Preparing Custom Examples with the OpenAI CLI 104
Setting Up the OpenAI CLI 108
Our First Fine-Tuned LLM 109
Summary 119
Chapter 6: Advanced Prompt Engineering 121
Introduction 121
Prompt IlÁ