Book description
Large language models (LLMs) and diffusion models such as ChatGPT and Stable Diffusion have unprecedented potential. Because they have been trained on all the public text and images on the internet, they can make useful contributions to a wide variety of tasks. And with the barrier to entry greatly reduced today, practically any developer can harness LLMs and diffusion models to tackle problems previously unsuitable for automation.
With this book, you'll gain a solid foundation in generative AI, including how to apply these models in practice. When first integrating LLMs and diffusion models into their workflows, most developers struggle to coax reliable enough results from them to use in automated systems. Authors James Phoenix and Mike Taylor show you how a set of principles called prompt engineering can enable you to work effectively with AI.
Learn how to empower AI to work for you. This book explains:
- The structure of the interaction chain of your program's AI model and the fine-grained steps in between
- How AI model requests arise from transforming the application problem into a document completion problem in the model training domain
- The influence of LLM and diffusion model architecture—and how to best interact with it
- How these principles apply in practice in the domains of natural language processing, text and image generation, and code
Publisher resources
Table of contents
- 1. Five Principles of Prompting
- 2. Intro to Image Generation Models
-
3. Standard Practices for Text Generation
- Generating Lists
- Hierarchical List Generation
- Generating JSON
- Filtering YAML Payloads
- Handling Invalid Payloads in YAML
- Explain It Like I’m Five
- Ask For Context
- Text Style Unbundling
- Identifying the Desired Textual Features
- Alternatively Extract Specific Relevant Textual Features
- Generating New Content with the Extracted Features
- Summarization
- Chunking Text
- Applying Prompt Engineering Principles
- Sentence Detection using SpaCy
- Building a simple chunking algorithm in Python
- Sliding Window Chunking
- Text chunking with Tiktoken
- Encodings
- Estimating Token Usage for Chat API Calls
- Sentinment Analysis
- Least To Most
- Role Prompting
- Summary
- 4. Standard Practices for Image Generation
- 5. Vector Databases
-
6. Advanced Techniques for Text Generation
- Meta Prompting
- GPT Best Practices
- Introduction to LangChain
- Langchain Prompt Templates
- Output Parsers
- Creating Few-Shot Prompt Templates
- Data Connection
- Text Splitters
- Text Segmentation with Recursive Character Splitting
- VectorStores
- Retrievers
- Task Decomposition
- Prompt Chaining
- Chain of Thought
- Agents
- Memory
- Memory in LangChain
- Popular Memory Types in LangChain
- Advanced Agent Frameworks
- Callbacks
- Classification with LLMs
- Building A Classification Model
- Majority Vote For Classification
- 7. Advanced Techniques for Image Generation
Product information
- Title: Prompt Engineering for Generative AI
- Author(s):
- Release date: July 2024
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781098153373
You might also like
book
Radar Trends to Watch: September 2023
Read about the latest developments on O'Reilly Media's Radar.
book
Technology Trends for 2023
In this report, we look at the data generated by the O'Reilly online learning platform to …
book
Creating Software with Modern Diagramming Techniques
Diagrams communicate relationships more directly and clearly than words ever can. Using only text-based markup, create …
book
The Self-Service Data Roadmap
Data-driven insights are a key competitive advantage for any industry today, but deriving insights from raw …