Buch, Englisch, 416 Seiten, Format (B × H): 185 mm x 231 mm, Gewicht: 794 g
Buch, Englisch, 416 Seiten, Format (B × H): 185 mm x 231 mm, Gewicht: 794 g
ISBN: 978-1-394-37313-0
Verlag: Wiley
Create, implement, and scale commercially successful generative AI applications that solve real-world problems
In A Developer's Guide to Integrating Generative AI into Applications, software developer, technology educator, and author Chris Minnick explain exactly how to design and implement scalable generative AI applications. The book walks you through building production-ready GenAI applications, covering the key architectural choices, integration patterns, and design practices needed to deliver accurate, efficient, and commercially viable solutions.
Minnick demonstrates the principles and techniques you need to succeed in the rapidly evolving GenAI space in real-world business environments. He shows how to overcome the practical challenges developers face when embedding generative AI into products, from designing effective prompts to managing performance and cost, with hands-on examples that demonstrate proven techniques you can apply immediately.
You’ll discover: - Step-by-step guides to using AI APIs, SDKs, AI-generated data, and synthetic users
- Up-to-date explanations of how to build AI-powered chatbots and assistants, AI-driven content-enhancement services, code generation and software development tools, and AI search and recommendation utilities
- How to improve your interface and UX design with AI features
- Explorations of business and scaling considerations, including how to monetize AI features, how to optimize AI for both performance and cost, and case studies of successful products that incorporate GenAI
Perfect for software developers, product managers, engineering leaders, and UX designers, A Developer's Guide to Integrating Generative AI into Applications is your essential guide to integrating generative AI into real products and creating the AI-powered applications that will define the next era of software.
Autoren/Hrsg.
Weitere Infos & Material
Introduction xxvii
Part I Foundations of Generative AI 1
Chapter 1 Introduction to Generative AI 3
Evolution of AI Applications 4
Key Eras of AI Development 4
Logic and Rules-Based Systems 4
Early Machine Learning 5
Expert Systems 5
Big Data and Statistical Machine Learning 5
Deep Learning 6
The Rise of Generative AI 8
Transition to GenAI 9
Understanding AI and ml 11
What Machine Learning Can Do 12
Supervised Learning 12
Unsupervised Learning 13
Semi-Supervised Learning 13
Reinforcement Learning 13
Self-Supervised Learning 13
Large Language Models 14
Tokenization 14
Embedding 16
Transformer Layers 17
Prediction 18
What Makes Generative AI Different? 18
Generating Content 18
GenAI Is Necessarily Unpredictable 19
GenAI Is Probabilistic 19
GenAI Requires Prompt Design 19
GenAI Is Multimodal 19
GenAI Shifts UX Expectations 20
GenAI Needs Guardrails 20
Real-World Examples of AI Integration 20
AI-Enhanced Customer Service Bots 20
Generative Writing Tools 21
Image Generation in Creative Tools 22
Summary 24
Chapter 2 Understanding Generative AI Models 25
Key Factors in Choosing a Model 25
Cost and Pricing Structure 26
Licensing Model 26
Performance Metrics 27
Suitability for Your Use Case 28
Technical Features 28
Architecture 29
Parameter Count 30
Training Objective and Data 30
Fine-Tuning 30
Context Window 30
Unique Functionalities 31
Proprietary Models 31
GPT (OpenAI) 32
Claude (Anthropic) 33
DALL·E (OpenAI) 33
Gemini (Google DeepMind) 33
Open and Open-Source Models 34
OLMo (Allen AI) 35
Llama (Meta) 35
Stable Diffusion (Stability AI) 36
Deciding Between Proprietary and Open Models 36
When to Use Which Model 38
Adapting Your Model’s Abilities 39
Fine-Tuning 39
Prompt Engineering 40
Retrieval-Augmented Generation 40
Choosing the Right Adaptation Strategy 42
When to Use Non-Generative Models Alongside GenAI 43
Key Advantages of Non-Generative Approaches 43
Strategic Use Cases for Hybrid Approaches 43
Latency-Critical Applications 44
Cost and Performance Optimization 44
Quality Control and Validation 44
Preprocessing and Filtering 45
Decision-Making and Scoring 45
When to Choose Traditional Approaches Over AI 45
Summary 46
Chapter 3 Getting Started with AI APIs and SDKs 47
Exploring Hosted Models 47
Setting Up a Simple Development Environment 48
OpenAI Developer Platform 48
Getting an OpenAI API Key 49
Anthropic’s Build with Claude 55
Google Gemini Developer API 57
GenAI Integration Patterns 59
Common Architectural Models for Integrating GenAI 59
Backend Service Integration 59
Frontend-Only Integration 61
Plugin-Based Integration 66
Hybrid Integration 66
Model Access Patterns 66
Synchronous vs. Asynchronous 67
Streaming vs. Batch 68
Input Types for GenAI Integration 69
Plain Text Prompts 69
Structured Prompts 69
Multimodal Prompts 70
Response Handling 71
Integrating Responses into the User Interface 71
Logging and Analytics 71
Chaining Responses to Other Services 72
Combining Techniques 72
Summary 73
Chapter 4 AI-Generated Data and Synthetic Users 75
Generating Test Data with GenAI 76
Traditional Test Data Generation 76
Manual Generation 76
Automated Data Generation 76
Data Masking 76
Using GenAI for Test Data Generation 77
Introducing the Sample App 77
Techniques for Generating Synthetic Data 79
Few-Shot Prompting for Schema-Aligned Data 79
Template-Based Generation with Randomized Inputs 81
Structured Output Formats 83
Simulating User Behavior and Interaction Flows 86
Simulating Chat-Based Interactions 86
Simulating Navigational Flows and Multistep Interactions 87
Simulating Edge Case and Adversarial Behavior 88
Best Practices and Limitations of Behavior Simulation 89
Summary 90
Chapter 5 Prompt Engineering 91
Why Prompt Design Matters in GenAI Applications 92
Prompt Quality Affects Output Quality 92
Prompting Is Cheaper and Faster than Fine-Tuning 93
Prompts Shape the Voice and Tone of AI 93
Better Prompts Reduce Hallucinations 93
Prompts Embed Business Logic 94
Prompt Design Supports Edge Case Handling 94
Good Prompts Improve Performance and Reduce Cost 94
Prompt Types 95
Zero-Shot Prompting 95
Few-Shot Prompting 96
Chain-of-Thought Prompting 96
Prompting Best Practices 97
Guiding the LLM with System Messages 98
Prompt Templates for Repeatable Interactions 98
Adjusting Generation Parameters 101
Max Tokens 101
Temperature 102
Top P 103
Top K 104
Stop Sequences 104
Deciding How to Set Inference Parameters 104
Tooling for Prompt Development 105
In-Browser Prompt Playgrounds 105
Anthropic Workbench 105
OpenAI Playground 112
Google AI Studio 115
Prompt Management 116
Summary 117
Part II Designing for a Better AI Experience 119
Chapter 6 Human–AI Interaction and UX Design 121
Managing User Expectations 122
Clarify the AI’s Capabilities Up Front 123
Set Expectations Around Potential Failure 124
Communicate When Outputs are Probabilistic 124
Provide Cues that Suggest When the AI is “Thinking” 124
Use Progressive Disclosure to Build Trust 125
Avoid Overpromising AI Abilities 125
Designing Interfaces for AI-Powered Features 126
Understand the Users and Context 126
Ensure Clarity of AI-Generated vs. User-Generated Content 126
Provide Opportunities for Correcting or Refining AI Outputs 127
Use Visual or Interaction Cues to Indicate When the AI Is Active or Idle 127
Offer Undo or Step-Back Controls to Reduce Risk and Build Confidence 127
Design for Uncertainty and Failure 128
Balancing Automation with Human Control 128
Improving Over Time 129
Capturing and Using User Feedback 129
Balancing Explicit Ratings and Behavioral Signals 130
Learning Without Surprising Users 130
Monitoring for Drift and Relevance 130
Accessibility and Inclusion in AI UX 131
Accessibility Standards for AI Applications 131
Best Practices for Accessible AI UX 132
GenAI as an Accessibility Aid 134
Testing GenAI Accessibility 134
Using GenAI to Test GenAI Outputs 137
Human-Centered AI in the Real World 138
Summary 139
Chapter 7 Optimizing AI for Performance and Cost 141
From Prototype to Production 141
The Hidden Cost of GenAI Features 142
Why Optimization Matters 142
The Trade-Off Triangle 143
Minimize Latency and Reduce Redundant API Calls 144
Reduce Prompt Size 144
Reduce the Size of the Model’s Response 145
Use Caching to Avoid Redundant Calls 146
Cache Exact Prompt–Response Pairs 146
Prompt Fingerprint Caching 148
Reuse Similar Responses with Embedding Search 150
Parallelize Requests 153
Stream Responses 155
Precompute for Known Flows 157
Lightweight Fine-Tuning 158
Profile and Monitor Performance 158
Logging to Identify Latency Hotspots 159
Observability Tools for GenAI Systems 159
Handle Rate Limits Gracefully 160
Understanding Usage Tiers 162
Throttle and Buffer Requests 162
Design for Fallback and Graceful Degradation 162
Summary 163
Part III Integrating AI into Applications 165
Chapter 8 Building AI-Powered Chatbots and Assistants 167
Start with a Simple Chatbot 168
Principles of Conversational Interface Design 174
Managing Turn-Taking, Flow, and Feedback in Dialogue 175
Show Feedback and Errors 176
Temporarily Disable the Input to Prevent Accidental Repeat Submissions 178
Use Backchannel Cues and Confirmations 178
Guide the Next Turn 180
Keep the User Oriented 181
Handling Memory, Context, and User Personalization 183
Tracking Conversation History 183
Adding Basic Personalization 186
Steering AI Toward Specific Tasks or Domains 190
Using System Prompts to Constrain Behavior 190
Welcoming the User 192
When to Use RAG for External Knowledge 194
Adding Auto-Scroll and Streaming Responses 195
Designing for Fallback, Clarification, and Edge Cases 200
Clarify Ambiguous Questions 200
Fall Back When the Answer Isn’t Known 202
Handle Out-of-Scope Requests Gracefully 202
Best Practices for Customer Service Chatbots 203
Summary 204
Chapter 9 Generating and Enhancing Content with AI 205
Building SPOT: Fast, On-Brand, and Grounded 205
Overview of SPOT 206
Getting Set Up 208
Where to Put This in a Real Application 208
AI-Assisted Writing and Summarization 209
Going from Brief to Draft 209
Rewriting for Tone, Audience, and Locale 211
Summarization with Source Citations 212
Repurposing Long-Form Content 212
Choosing the Right Summarization Mode 213
Keep It On-Brand with the Style Pack 214
Prompt-Time Injection 214
Post-Generation Validation 215
Implementation Patterns for Your Own Apps 218
Grounded Writing with RAG 218
Structured Outputs for Pipelines 220
Evaluation and Human Review 220
Accessibility and Inclusive Language 221
Legal, IP, and Disclosure Considerations 223
AI-Generated Images and Media 224
Design First, Pixels Second 224
Maintain Brand Consistency in Visuals 225
Image Editing Workflows 226
Audio and Voice Features 226
Video Workflows: Storyboard First, Shots Second 227
Measure What Matters 228
Logging and Provenance for Media 228
Personalization and Dynamic Content 229
Understanding the Personalization Spectrum 229
Defining Your Signals and Features 230
Runtime vs. Precomputed Variants 230
Adding Guardrails for Fairness and Safety 231
Experimenting and Optimizing 231
Localizing and Adapting Across Cultures 231
Locale-Specific Spelling and Grammar 232
Multilingual Prompt Templates 232
Cultural Norms and Communication Style 233
Regional Imagery and References 233
Showing Your Work: UX Patterns for Trust 234
Common Pitfalls and How to Avoid Them 235
Fabrication Masquerading as Authority 235
Brand Drift 236
Over-Personalization 236
Hidden Costs and Latency Surprises 237
Schema Drift and Output Parsing Failures 237
Evaluation Gaps 237
Legal and Regulatory Surprise 238
Summary 238
Chapter 10 AI for Code Generation and Developer Tools 239
Setting Up and Using PACE 240
Installation 241
The Interface 241
Using PACE 241
Adding Your Own Features 242
Writing Prompt Templates for Common Coding Tasks 243
Viewing the Built-In Prompts 243
Explaining Code 244
Generating Function Stubs 245
Error Helpers 246
Adding Comments 246
Optimization Suggestions 247
Automating Repetitive Work with Prompts 248
Generating Boilerplate 248
Performing Refactors 249
Suggesting Reviews and Improvements 250
Combining Prompts 251
When Not to Automate 251
Prompts for Testing and Debugging 251
Generating Unit Tests 252
Explaining Test Failures 252
Debugging Runtime Issues 253
Spotting Performance and Security Issues 253
Improving the Developer Experience Around Testing 254
Caution: Don’t Overtrust Test Generation 255
Best Practices for Prompt-Driven Tools 255
Show a Diff, Not a Blob 255
Run Formatters and Linters Automatically 256
Keep Prompts Short, Modular, and Reusable 257
Be Explicit About Intent and Output 257
Ask for Multiple Options When Appropriate 257
Let the Model Say “I Don’t Know” 258
Treat Prompts Like Code 258
Start Narrow, Then Generalize 259
Avoid Prompt Sprawl 259
Design for Human Control 259
Building Better Dev Tools 260
Add New Prompt Capabilities 260
Improve the UI 260
Store Templates Persistently 261
Add Support for Other AI Providers 261
Experiment with Retrieval 261
Share Prompt Collections 262
Summary 262
Chapter 11 Enhancing Search and Recommendations with AI 263
Why Traditional Search Falls Short 264
Vector Search and Embeddings 264
Building a Vector Search Demo with Embeddings 266
Step 1. Prepare the Project 266
Step 2. Create a Utility for Similarity 267
Step 3. Build the Index 267
Step 4. Implement Search 268
Step 5. Try It Out 269
Reranking with LLMs 269
Conversational Search 271
Personalized Recommendations 272
Classic Approaches 272
AI-Enhanced Recommendations 273
Building a Simple Recommender with Embeddings + User Profiles 273
Step 1. Prepare the Project 274
Step 2. Add Utility Functions 275
Step 3. Embed Items and Save the Index 276
Step 4. Compute User Vectors 277
Step 5. Generate Recommendations 278
Step 6. Add “Why This” Explanations 280
Dynamic Personalization 281
Evaluation and Feedback Loops 282
Hybrid Approaches 282
Introduction to FUSE 283
Installing and Launching FUSE 284
How It Works 284
Comparing Search Modes 284
Personalization in Action 286
Experimenting with Retrieval and Ranking 286
Summary 287
Part IV Business Considerations 289
Chapter 12 Ethical Considerations and Pitfalls 291
Bias and Fairness in Generative AI 291
Real-World Impacts 292
Mitigation Strategies 293
Test with Synthetic Users 294
Apply Prompt Engineering to Steer Outputs Toward Inclusivity 294
Build User Controls and Transparency Mechanisms 294
Use Models or APIs with Fairness Tuning or Moderation Filters 296
Developer’s Responsibility 298
Document Observed Biases 298
Provide Mechanisms for User Feedback and Correction 299
Treat Fairness Testing as a Continuous Process 299
Define Fairness Metrics and Conduct Regular Audits 299
Build Diverse Teams and Invest in Ethics Training 300
Handling Fabrication and Misinformation 300
Why Fabrication Happens 301
Next-Token Prediction, Not Truth Seeking 301
Gaps in the Training Data 302
Ambiguous or Overly Broad Prompts 302
Risks to Applications 302
Legal and Compliance Issues 303
Loss of User Trust 303
Amplification of Conspiracy Theories and Harmful Misinformation 303
Mitigation Strategies 303
Ground Outputs in Real Data 304
Constrain the Scope and Encourage Abstention 304
Build a Human-in-the-Loop Review 304
Label Outputs Clearly 304
Security and Privacy Concerns 305
Key Risks 305
Prompt Hacking 306
Prompt Injection 306
Prompt Leaking 307
Jailbreaking 307
Ethical vs. Malicious Prompt Hacking 307
Mitigation Strategies 308
Prevent Data Leakage 309
Defend Against Prompt Injection 309
Protect Training Data and RAG Pipelines 310
Mitigate Caching Risks 311
Regulatory and Compliance Issues 311
General Data Protection Regulation (GDPR) 311
EU AI Act 312
Other Legal Considerations 313
Industry-Specific Regulations 313
Finance 314
Healthcare 314
Education 314
Practical Steps for Developers 314
Developer’s Ethical Checklist 315
Summary 316
Chapter 13 Monetizing AI Features 317
Understanding AI Feature Costs and Value 317
Estimating the Per-Use Cost of ToasterBot Deployment 318
Per-Use Cost Components Breakdown 318
Example: Cost of a Single Chat Session 321
Cost Comparison: API-Based vs. Self-Hosted Deployment 323
Pricing Strategies: Cost-Based vs. Value-Based 325
Cost-Based Pricing 325
Value-Based Pricing 325
When and How to Charge for AI Features 326
Tiered Subscription Models 326
Usage-Metering and Rate Limits 327
Paywall Strategies 329
Value Communication and Pricing Iteration 330
Indirect Monetization of AI Features 330
Implementation and Engineering Considerations for Monetization 331
API Usage Tracking and Token Counting 331
Enforcing Limits and Feature Gating 335
Integrating Billing and Payments 337
Architecture Example: Implementing Monetization 337
Cost Modeling and Forecasting in Code 338
Applying Monetization Strategies to Example Apps 340
SimpleBot/ToasterBot: AI Chatbot 340
SPOT: Structured Prompt Output Toolkit 341
PACE: Prompt-Augmented Coding Environment 342
FUSE: Find, Understand, Search, Enhance 343
Summary 344
Chapter 14 Successful AI-Powered Products 345
Case Studies 345
Ups Orion 346
Nuance DAX: Ambient Clinical Documentation 346
Real-World Examples of AI-driven Applications 347
AudioPen 348
Consensus 350
Humata 351
Eightify 353
Scribe 354
Tability 356
tl;dv 357
Lessons Learned from Successful Implementations 358<




