Building LLM Powered Applications delves into the fundamental concepts, cutting-edge technologies, and practical applications that LLMs offer, ultimately paving the way for the emergence of large foundation models (LFMs) that extend the boundaries of AI capabilities. The book begins with an in-dept
Generative AI with LangChain: Build large language model (LLM) apps with Python, ChatGPT and other LLMs
โ Scribed by Ben Auffarth
- Publisher
- Packt
- Year
- 2023
- Tongue
- English
- Leaves
- 361
- Category
- Library
No coin nor oath required. For personal study only.
โฆ Synopsis
ChatGPT and the GPT models by OpenAI have brought about a revolution not only in how we write and research but also in how we can process information. This book discusses the functioning, capabilities, and limitations of LLMs underlying chat systems, including ChatGPT and Bard. It also demonstrates, in a series of practical examples, how to use the LangChain framework to build production-ready and responsive LLM applications for tasks ranging from customer support to software development assistance and data analysis โ illustrating the expansive utility of LLMs in real-world applications.
Unlock the full potential of LLMs within your projects as you navigate through guidance on fine-tuning, prompt engineering, and best practices for deployment and monitoring in production environments. Whether you're building creative writing tools, developing sophisticated chatbots, or crafting cutting-edge software development aids, this book will be your roadmap to mastering the transformative power of generative AI with confidence and creativity.
What you will learn
โข Understand LLMs, their strengths and limitations
โข Grasp generative AI fundamentals and industry trends
โข Create LLM apps with LangChain like question-answering systems and chatbots
โข Understand transformer models and attention mechanisms
โข Automate data analysis and visualization using pandas and Python
โข Grasp prompt engineering to improve performance
โข Fine-tune LLMs and get to know the tools to unleash their power
โข Deploy LLMs as a service with LangChain and apply evaluation strategies
โข Privately interact with documents using open-source LLMs to prevent data leaks
Who this book is for
The book is for developers, researchers, and anyone interested in learning more about LLMs. Basic knowledge of Python is a prerequisite, while
โฆ Table of Contents
Cover
Copyright
Contributors
Table of Contents
Preface
Chapter 1: What Is Generative AI?
Introducing generative AI
What are generative models?
Why now?
Understanding LLMs
What is a GPT?
Other LLMs
Major players
How do GPT models work?
Pre-training
Tokenization
Scaling
Conditioning
How to try out these models
What are text-to-image models?
What can AI do in other domains?
Summary
Questions
Chapter 2: LangChain for LLM Apps
Going beyond stochastic parrots
What are the limitations of LLMs?
How can we mitigate LLM limitations?
What is an LLM app?
What is LangChain?
Exploring key components of LangChain
What are chains?
What are agents?
What is memory?
What are tools?
How does LangChain work?
Comparing LangChain with other frameworks
Summary
Questions
Chapter 3: Getting Started with LangChain
How to set up the dependencies for this book
pip
Poetry
Conda
Docker
Exploring API model integrations
Fake LLM
OpenAI
Hugging Face
Google Cloud Platform
Jina AI
Replicate
Others
Azure
Anthropic
Exploring local models
Hugging Face Transformers
llama.cpp
GPT4All
Building an application for customer service
Summary
Questions
Chapter 4: Building Capable Assistants
Mitigating hallucinations through fact-checking
Summarizing information
Basic prompting
Prompt templates
Chain of density
Map-Reduce pipelines
Monitoring token usage
Extracting information from documents
Answering questions with tools
Information retrieval with tools
Building a visual interface
Exploring reasoning strategies
Summary
Questions
Chapter 5: Building a Chatbot like ChatGPT
What is a chatbot?
Understanding retrieval and vectors
Embeddings
Vector storage
Vector indexing
Vector libraries
Vector databases
Loading and retrieving in LangChain
Document loaders
Retrievers in LangChain
kNN retriever
PubMed retriever
Custom retrievers
Implementing a chatbot
Document loader
Vector storage
Memory
Conversation buffers
Remembering conversation summaries
Storing knowledge graphs
Combining several memory mechanisms
Long-term persistence
Moderating responses
Summary
Questions
Chapter 6: Developing Software with Generative AI
Software development and AI
Code LLMs
Writing code with LLMs
StarCoder
StarChat
Llama 2
Small local model
Automating software development
Summary
Questions
Chapter 7: LLMs for Data Science
The impact of generative models on data science
Automated data science
Data collection
Visualization and EDA
Preprocessing and feature extraction
AutoML
Using agents to answer data science questions
Data exploration with LLMs
Summary
Questions
Chapter 8: Customizing LLMs and Their Output
Conditioning LLMs
Methods for conditioning
Reinforcement learning with human feedback
Low-rank adaptation
Inference-time conditioning
Fine-tuning
Setup for fine-tuning
Open-source models
Commercial models
Prompt engineering
Prompt techniques
Zero-shot prompting
Few-shot learning
Chain-of-thought prompting
Self-consistency
Tree-of-thought
Summary
Questions
Chapter 9: Generative AI in Production
How to get LLM apps ready for production
Terminology
How to evaluate LLM apps
Comparing two outputs
Comparing against criteria
String and semantic comparisons
Running evaluations against datasets
How to deploy LLM apps
FastAPI web server
Ray
How to observe LLM apps
Tracking responses
Observability tools
LangSmith
PromptWatch
Summary
Questions
Chapter 10: The Future of Generative Models
The current state of generative AI
Challenges
Trends in model development
Big Tech vs. small enterprises
Artificial General Intelligence
Economic consequences
Creative industries and advertising
Education
Law
Manufacturing
Medicine
Military
Societal implications
Misinformation and cybersecurity
Regulations and implementation challenges
The road ahead
Other Books You May Enjoy
Index
๐ SIMILAR VOLUMES
Get hands-on with GPT 3.5, GPT 4, LangChain, Llama 2, Falcon LLM and more, to build LLM-powered sophisticated AI applications Key Features Embed LLMs into real-world applications Use LangChain to orchestrate LLMs and their components within applications Grasp basic and advanced techniques of prom
<p><span>This book provides a deep dive into the world of generative AI, covering everything from the basics of neural networks to the intricacies of large language models like ChatGPT and Google Bard. It serves as a one-stop resource for anyone interested in understanding and applying this transfor
<p><span>This book provides a deep dive into the world of generative AI, covering everything from the basics of neural networks to the intricacies of large language models like ChatGPT and Google Bard. It serves as a one-stop resource for anyone interested in understanding and applying this transfor
Use LLMs to build better business software applications Autonomously communicate with users and optimize business tasks with applications built to make the interaction between humans and computers smooth and natural. Artificial Intelligence expert Francesco Esposito illustrates several scenarios
<p><span>Use LLMs to build better business software applications</span></p><p><span>Autonomously communicate with users and optimize business tasks with applications built to make the interaction between humans and computers smooth and natural. Artificial Intelligence expert Francesco Esposito illus