Previous Next

Patterns of Application Development Using AI (Obie Fernandez)(Z-Library)

Author: Obie Fernandez

其他

No Description

📄 File Format: PDF
💾 File Size: 2.4 MB
15
Views
0
Downloads
0.00
Total Donations

📄 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.

📄 Page 1
(This page has no text content)
📄 Page 2
Patterns of Application Development Using AI Obie Fernandez This book is available at http://leanpub.com/patterns-of-application-development-using-ai This version was published on 2024-10-23 This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and many iterations to get reader feedback, pivot until you have the right book and build traction once you do. © 2024 Obie Fernandez
📄 Page 3
Tweet This Book! Please help Obie Fernandez by spreading the word about this book on Twitter! The suggested hashtag for this book is #poaduai. Find out what other people are saying about the book by clicking on this link to search for this hashtag on Twitter: #poaduai
📄 Page 4
Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii About the Code Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv What I Don’t Cover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v Who This Book Is For . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii Building a Common Vocabulary . . . . . . . . . . . . . . . . . . . . . . . . . viii Getting Involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix What’s with the illustrations? . . . . . . . . . . . . . . . . . . . . . . . . . . . x About Lean Publishing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x About The Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Thoughts on Software Architecture . . . . . . . . . . . . . . . . . . . . . . . 2 What is a Large Language Model? . . . . . . . . . . . . . . . . . . . . . . . . 3 Understanding Inference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Thinking About Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Experimenting With Different LLM Models . . . . . . . . . . . . . . . . . . 27 Compound AI Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Part 1: Fundamental Approaches & Techniques . . . . . . . . . . . . . . . . . 35 Narrow The Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Latent Space: Incomprehensibly Vast . . . . . . . . . . . . . . . . . . . . . . 38 How The Path Gets “Narrowed” . . . . . . . . . . . . . . . . . . . . . . . . . 42
📄 Page 5
CONTENTS Raw Versus Instruct-Tuned Models . . . . . . . . . . . . . . . . . . . . . . . 46 Prompt Engineering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Prompt Distillation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 What about fine-tuning? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Retrieval Augmented Generation (RAG) . . . . . . . . . . . . . . . . . . . . . . 75 What is Retrieval Augmented Generation? . . . . . . . . . . . . . . . . . . 76 How Does RAG Work? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Why Use RAG in Your Applications? . . . . . . . . . . . . . . . . . . . . . . . 77 Implementing RAG in Your Application . . . . . . . . . . . . . . . . . . . . . 78 Proposition Chunking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Real-World Examples of RAG . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 Intelligent Query Optimization (IQO) . . . . . . . . . . . . . . . . . . . . . . 89 Reranking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 RAG Assessment (RAGAs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Challenges and Future Outlook . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Multitude of Workers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 AI Workers As Independent Reusable Components . . . . . . . . . . . . . 103 Account Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 E-commerce Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Healthcare Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 AI Worker as a Process Manager . . . . . . . . . . . . . . . . . . . . . . . . . 118 Integrating AI Workers Into Your Application Architecture . . . . . . . . 121 Composability and Orchestration of AI Workers . . . . . . . . . . . . . . . 124 Combining Traditional NLP with LLMs . . . . . . . . . . . . . . . . . . . . . 132 Tool Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 What is Tool Use? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 The Potential of Tool Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 The Tool Use Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Best Practices for Tool Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
📄 Page 6
CONTENTS Composing and Chaining Tools . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Future Directions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Stream Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Implementating a ReplyStream . . . . . . . . . . . . . . . . . . . . . . . . . . 160 The “Conversation Loop” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Auto Continuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 Self Healing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 Practical Case Study: Fixing Broken JSON . . . . . . . . . . . . . . . . . . . 174 Considerations and Counterindications . . . . . . . . . . . . . . . . . . . . 179 Contextual Content Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 Personalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 Productivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Rapid Iteration and Experimentation . . . . . . . . . . . . . . . . . . . . . . 198 AI Powered Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 The Importance of User Testing and Feedback . . . . . . . . . . . . . . . . 202 Generative UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Generating Copy for User Interfaces . . . . . . . . . . . . . . . . . . . . . . 205 Defining Generative UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 The Shift to Outcome-Oriented Design . . . . . . . . . . . . . . . . . . . . 217 Challenges and Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . 218 Future Outlook and Opportunities . . . . . . . . . . . . . . . . . . . . . . . 220 Intelligent Workflow Orchestration . . . . . . . . . . . . . . . . . . . . . . . . 223 Business Need . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Key Benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 Key Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 Exception Handling and Recovery . . . . . . . . . . . . . . . . . . . . . . . . 228
📄 Page 7
CONTENTS Implementing Intelligent Workflow Orchestration in Practice . . . . . . 231 Monitoring and Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 Scalability and Performance Considerations . . . . . . . . . . . . . . . . . 248 Testing and Validation of Workflows . . . . . . . . . . . . . . . . . . . . . . 253 Part 2: The Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 Prompt Engineering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 Chain of Thought . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Mode Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 Role Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 Prompt Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 Prompt Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 Structured IO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 Prompt Chaining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 Prompt Rewriter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 Response Fencing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 Query Analyzer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 Query Rewriter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 Ventriloquist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 Discrete Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 Predicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 API Facade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 Result Interpreter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 Virtual Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 Human In The Loop (HITL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 High-Level Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 Escalation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 Feedback Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 Passive Information Radiation . . . . . . . . . . . . . . . . . . . . . . . . . . 366
📄 Page 8
CONTENTS Collaborative Decision Making (CDM) . . . . . . . . . . . . . . . . . . . . . 371 Continuous Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 Ethical Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 Technological Advancements and Future Outlook . . . . . . . . . . . . . 383 Intelligent Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 Traditional Error Handling Approaches . . . . . . . . . . . . . . . . . . . . 386 Contextual Error Diagnosis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 Intelligent Error Reporting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 Predictive Error Prevention . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 Smart Error Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 Personalized Error Communication . . . . . . . . . . . . . . . . . . . . . . . 404 Adaptive Error Handling Workflow . . . . . . . . . . . . . . . . . . . . . . . 406 Quality Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 Eval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 Guardrail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416 Guardrails and Evals: Two Sides of the Same Coin . . . . . . . . . . . . . 419 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
📄 Page 9
Preface In March of 2023, I had an eye-opening experience playing Dungeons & Dragons with my kids using the newly available GPT-4 as our Dungeon Master (DM). It guided us through an immersive, reactive adventure, demonstrating a remarkable ability to spin a compelling narrative, track complex game state, and adapt on the fly to our actions and decisions. The experience crystalized for me the immense potential that large language models (LLMs) have to transform how we build software. Just as GPT-4 was able to serve as a highly capable DM for me and my kids, LLMs are capable of serving as building blocks for many functions that we currently build in traditional ways, or don’t build at all for fear of the complexity involved. I firmly believe that AI’s impact on developer ambition and productivity will be profound, and transform the world in ways that at the moment we can only glimpse. Wielding this power effectively will require evolving our tools, techniques and mindsets. We’ll need to establish new design patterns, fresh best practices and guardrails for prompt engineering, output parsing, model selection, and human feedback loops. We must learn to play to the strengths of LLMs while mitigating their weaknesses and failure modes. Luckily, after that initial experience with GPT-4, I wasted no time exploring the possibilities that this new world of artificial intelligence offered. I scrambled to write my own assistant bot platform in Ruby on Rails, and announced it as new open source software at RailsConf 2023. A week later, my girlfriend Victoria was complaining about one of her col- leagues at work, an underpaid copywriter whose work she was constantly having to rewrite. I offered to create an AI copywriter for her using my new platform. After using the AI copywriter for a few days, she was hooked, and
📄 Page 10
Preface ii she asked me if I could make her an entire content team. Within hours I had whipped up additional AI-powered consultants, ranging from a PR expert to SEO consultant, and that’s how my newest startup venture was conceived. Seeing Victoria’s enthusiasm and productivity jump with AI assistance showed me the potential for a startling new startup, one that could potentially replace humans with artificially intelligent team members. Victoria quit her job and joined me as CEO and Co-founder and a couple months later we launched Olympia. As the sole developer working under the pressure of crushing time constraints, I jumped on every opportunity I could find to replace typical software approaches with LLM-powered functions and components. I learned a lot about what works, and what doesn’t (yet). Enough that, after a year of coding with AI every day, I think I’ve got quite a bit of radical new information to share with the world. That epic D&D game with ChatGPT-4 that gave me a glimpse of the future was so compelling that I wrote it up. The resulting blog post went viral and garnered hundreds of thousands of views within days. You can read it yourself here. In this book, I share my journey of building Olympia while trying to illuminate the key patterns that I discovered along the way. Through a combination of narrative chapters and detailed pattern references, I aim to provide a comprehensive guide to the application development that leverages AI for fun and profit.
📄 Page 11
Preface iii About the Book The book is divided into two parts. Part 1 consists of chapters exploring fundamental concepts, challenges, and solutions related to using LLM-based AI in your application development. Throughout these narrative chapters, I try to provide realistic code examples and real-world anecdotes to illustrate the practical application of the book’s patterns and the impact they had on my development process. By reading Part 1, you’ll gain a deep understanding of how to use AI to create intelligent, adaptive, and user-centric applications. Part 2 is meant to be a comprehensive reference section for the patterns introduced throughout Part 1. It’s a practical guide that you can refer to whenever you need to dive into the details of a specific pattern. Each pattern in Part 2 is presented in a consistent format, providing a concise description of the problem it addresses, the solution it offers, and the con- siderations for its implementation. Where possible, I include code examples, diagrams, and best practices to help you understand how to apply these patterns in your own projects. The pattern references in Part 2 are organized by category, to make it as easy as possible for you to navigate and find the information you need. Unlike the narrative chapters in Part 1, which are meant to be read sequentially to build a conceptual foundation, the pattern references in Part 2 can be accessed independently based on your specific needs and interests. You can dive into a particular pattern when you encounter a related challenge in your own application development journey or use Part 2 as a quick reference guide while implementing these patterns in your codebase. My goal is for it to serve as a valuable resource that you can revisit time and time again as you work on different projects and encounter new challenges. One of the reasons that I’m so excited about writing this book is that for the first time in a long time, probably since the earliest versions of The Rails Way,
📄 Page 12
Preface iv the information in this book is drawn directly from my experiences and insights while working with brand-new technology! As I still work on building Olympia every day, I’m able to use its codebase as a source for real-world examples and practical advice on how to apply the patterns in your own projects. And if I come up with new ideas while working on the book, I can try them out on the Olympia codebase to see if they make sense in production use. It’s the best possible situation to be in as a technical book author! As you read through the chapters and explore the patterns, I encourage you to experiment, adapt, and build upon these ideas yourself. We’re living in exciting times and the true power of these patterns lies in their ability to inspire and empower you to create applications that push the boundaries of what’s possible. I’m sure many of you reading this book are going to come up with ideas that go above and beyond what I present here, the state of the art in AI is simply that expansive in its scope and capabilities! That said, don’t hesitate to get in contact with me if you have questions or want to offer feedback and suggestions. About the Code Examples For those of you that are not familiar with my previous work, it’s important to point out that all code examples in this book are written in Ruby, reflecting my almost 20 years of experience as a Ruby on Rails developer. I was arguably the first person doing enterprise software consulting with Ruby on Rails in 2005, and there are probably only a handful of people in the world that know Rails inside and out better than I do. While some readers might expect Python code samples, given its popularity in the AI community, there are a few reasons that I stuck with Ruby. First, as I just mentioned it’s what I know best. Second, to the extent possible the code examples will be pulled directly from Olympia’s source code with as little modification as possible. Third, Ruby is an extremely readable language, and indeed at its best it reads almost like English natural language. Finally,
📄 Page 13
Preface v I do firmly believe that the principles and patterns discussed in this book are language-agnostic and can be applied to any programming language or framework. In the rapidly evolving landscape of artificial intelligence, I suppose that it’s natural to wonder about the longevity and relevance of the code examples in this book, if not the entire thing. While the specific technologies and tools used in application development with AI may change and advance at a rapid pace, the fundamental concepts and patterns that underlie successful use of these tools should remain constant. The kinds of patterns presented in this book, such as the “Multitude of Workers,” “Self-Healing Data,” and “Contextual Content Generation,” are not tied to any particular programming language, framework, or AI platform. Instead, they represent approaches that can be adapted and applied across a wide range of problem domains. I firmly believe that the patterns and principles that I outline will stand the test of time, making it an evergreen resource for developers and architects. There’s a few modules that you’ll see consistently included in sample code: • Raix::ChatCompletion • Raix::PromptDeclarations • Raix::FunctionDispatch Those modules can be found in my open-source Raix library. Please do try using it in your own projects. What I Don’t Cover While AI is a central theme, the book is not about AI-driven development in the sense of AI replacing or automating the role of software developers. Throughout, I try to stay hyperfocused on how developers can harness the
📄 Page 14
Preface vi power of AI components and functions to enhance and augment traditional programming techniques, not how they can use AI to automate their own jobs. That debate around AI potentially taking over human jobs is a complex and speculative one, and better discussed over drinks. My personal assumption is that programming work, in many if not most domains, will largely remain recognizable for the next 10 years or so. Developers will continue to play a crucial role in designing, implementing, and maintaining all kinds of software systems. What I do expect to change dramatically is the power and capabilities of individ- ual AI-powered components that developers can leverage in their applications. As AI technologies advance, particularly in the realm of large language models (LLMs), the potential for these components to handle real-world complexity grows exponentially. That exponentially increasing power is where the true value of AI in application development lies, and why you should be diving head first into the approaches and techniques that I present in this book. LLMs and other AI components can tackle complex problems and scenarios that would be impractical or even impossible to address using traditional algorithmic and procedural approaches. These AI-powered components can understand and process natural language, generate contextually relevant content, and adapt to dynamic and evolving re- quirements in ways that would be incredibly challenging and time-consuming (aka impossible) for the vast majority of developers to implement from scratch. I also want to point out that while the book focuses on the practical application of AI in software development, it does not wander into the philosophical or societal implications of AI’s increasing capabilities, nor will it touch anything to do with alignment or safety concerns. I’m leaving the broader discussions about the future of AI and its impact on the software development industry to other forums.
📄 Page 15
Preface vii Who This Book Is For This book is written for software developers, architects, and technology leaders who are interested in leveraging the power of large language models (LLMs) to build intelligent, adaptive, and user-centric applications. Whether you’re a seasoned developer looking to incorporate AI into your existing projects or a curious technologist eager to explore the potential of AI in application development, this book is for you. If you’re a developer who has been working with traditional programming paradigms and is seeking ways to enhance your applications with AI capabilities, this book will provide you with practical patterns and principles to guide your journey. Importantly, it should help you answer the question: Where do I begin? You’ll learn how to integrate AI components and functions into your application architecture, enabling you to build software systems that are more scalable, resilient, and adaptable to real-world complexity. Technology leaders and high-level system architects should also find value in this book, as it provides a strategic perspective on how AI can be leveraged to create intelligent and user-centric applications. By understanding the patterns and principles presented in this book, you’ll be better equipped to make informed decisions about incorporating AI into your organization’s technology stack and guiding your teams in the effective use of AI-powered components. While the book assumes a basic understanding of software development con- cepts and practices, it does not require deep expertise in AI or machine learning. The patterns and principles presented in this book are explained in a clear and accessible manner, making them applicable to developers with varying levels of experience and technical backgrounds. Whether you’re working on enterprise applications, web services, mobile apps, or any other type of software system, the concepts and techniques covered in this book are relevant and transferable. The patterns and principles are not
📄 Page 16
Preface viii tied to any specific programming language, framework, or AI platform, making them applicable across a wide range of technologies and domains. If you’re excited about the potential of AI to transform the way we build software and are looking for practical guidance on how to harness its power in your own projects, this book is for you. Whether you’re a hands-on developer, an architect designing the overall structure of an application, or a technology leader setting the direction for your organization’s AI strategy, you’ll find valuable insights and actionable advice in these pages. So, if you’re ready to embark on a journey of exploring the intersection of AI and application development, if you’re eager to learn how to build intelligent, adaptive, and user-centric software systems, and if you’re committed to staying at the forefront of technological innovation, then this book is for you. Join me as we dive into the world of AI-powered application development and discover the patterns and principles that will shape the future of software engineering. Building a Common Vocabulary One of my key aspirations for this book is to contribute to the development of a common vocabulary around AI-powered application development. As the field of AI continues to evolve and mature, it’s crucial that we, as a community of developers, architects, and technology leaders, have a shared language to effectively communicate ideas, patterns, and best practices. By presenting a set of well-defined patterns and principles, such as “Self- Healing Data,” and “Contextual Content Generation,” this book aims to establish a foundation for a common vocabulary. These patterns provide a way to talk about the challenges, solutions, and architectural decisions involved in incorporating AI into application development. By adopting this vocabulary, we can facilitate clearer communication, foster collaboration, and enable the sharing of knowledge and experiences across teams, organizations, and the
📄 Page 17
Preface ix wider developer community. Getting Involved I post about technology topics at least a few times a month on my blog: https://obie.medium.com/ Also, follow me on Twitter or LinkedIn to see what I am up to or to comment on my posts: http://twitter.com/obie http://www.linkedin.com/in/obiefernandez Acknowledgments I have been collecting notes for this book for awhile, but finally decided to go all in while in Las Vegas, where I delivered “The Biggest Wave of All” as the closing keynote for Sin City Ruby 2024. I want to express appreciation to Jason Swett, organizer of the conference for the invitation to speak and our many years of friendship and collaboration. Alex Rudall is the host of the Ruby AI Builders Discord and author of several key open source libraries for doing AI in Ruby, including the vital ruby-openai and anthropic gems. My small contributions to those projects, as well as participation in the Discord has been instrumental in getting me excited about the potential of the space and writing this book. I’d be remiss to not thank Kirk Maple of Graphlit for countless conversations helping me to understand how to do RAG properly. Additionally, I’d like to give a shoutout to other inspiring friends in the commu- nity: Andrei Bondarev, Derek Neighbors, Landon Gray, Lance Carlson, Dewayne VanHoozer, and Scott Werner.
📄 Page 18
Preface x Many more TK! What’s with the illustrations? I’m a big fan of including art in technical books, but usually don’t have the re- sources to invest in bespoke illustrations. The decision to includemy own hand- drawn illustrations in not-to-be-mentioned previous books was questionable at best! This time around is different because of a wonderful generative AI product called Midjourney, with which I have a lifetime generation count approaching 10 thousand images. That’s a lot compared to most people! You could say that making AI art has become one of my favorite hobbies. I’ve even printed large- format giclee versions of some of my creations and hung them in the walls of my home. For this book, I used Midjourney to create illustrations that evoke the spirit of each chapter. Some have obvious references to their accompanying material, while others are purposely more abstract and meant to involve a measure of guesswork. Either way, I sincerely hope you enjoy them. By the way, if you see a diagram, I’ve created it using Mermaid, a JavaScript- based diagramming and charting tool that allows you to create diagrams and visualizations using a simple and intuitive Markdown-like syntax. It’s particu- larly useful for developers and technical writers who want to include diagrams in their documentation or presentations without relying on complex software or tools. About Lean Publishing Lean Publishing is the act of publishing an in-progress book using lightweight tools and many iterations to get reader feedback, pivoting until you have the
📄 Page 19
Preface xi right book and building traction once you do. As you read early drafts of this book, you will notice the initials TK inter- spersed liberally within the manuscript. It’s a placeholder meaning “to come” and it’s used by writers to indicate that additional information, details, or content needs to be added later. The unique combination of letters “TK” is rarely found in English words, making it easy to search for and find these placeholders in a text to replace them with the actual intended content before finalizing the draft. But, why would anyone want to publish a book that’s in progress? The fundamental reason is that a book is a startup: a risky, highly creative endeavor with low probability of success. Writing a book in “stealth mode” is a pretty good way to create something that nobody wants. The best way to determine whether you’re building something that people do want is to show it to them, shamelessly. I’ve been a huge fan of Leanpub and their founder Peter Armstrong since he launched all the way back in 2010. I initially heard about the service through my connection to Eric Ries while serving as a co-founder of his training company called Lean Startup Machine. It was lucky timing, since through that connection I ended up being one of the first successful Leanpub authors and even scored a lifetime free membership. There’s really no better way to write a book and if you’re an aspiring author, I encourage you to give Leanpub a deep look!
📄 Page 20
Preface xii About The Author Obie Fernandez is a noted technical author and serial entrepeneur. His latest venture, Olympia, provides solopreneurs and small business owners with AI- powered virtual consultants. Olympia is the fertile ground from which much of the knowledge in this book is harvested. Obie is the author of “The Rails Way” and his contributions to the Ruby on Rails community are widely recognized and respected. He founded Hashrocket, one of the most famous Ruby on Rails consultancies back in 2007, and sold it in 2011 to pursue success in the product startup world. His subsequent role as CTO on the founding team of Andela, along with successful entrepreneurial exits, underscores his leadership and business acumen. Prior to that, he was involved in the hacker and BBS scene in the late 80s and began his career as a professional programmer in the early ’90s. From Java to Ruby, Lean Startup, Serverless, and now AI, Obie’s forward-thinking
The above is a preview of the first 20 pages. Register to read the complete e-book.

💝 Support Author

0.00
Total Amount (¥)
0
Donation Count

Login to support the author

Login Now

Recommended for You

Loading recommended books...
Failed to load, please try again later
Back to List