Preface
What Are You Going to Learn?
To Whom is This Guide For?
Join the Community
About the Author
The Companion Toolkit
Your Feedback Matters
From NLP to Large Language Models
What is Natural Language Processing?
Language Models
Exercise 1
Statistical Models (N-Grams)
Exercise 2
Knowledge-Based Models
Contextual Language Models
Exercise 3
Neural Network-Based Models
Feedforward Neural Networks
Recurrent Neural Networks (RNNs)
Long Short-Term Memory (LSTM)
Gated Recurrent Units (GRUs)
Exercise 4
Transformer Models
Bidirectional Encoder Representations from Transformers (BERT)
Generative pre-trained transformer (GPT)
Exercise 5
What’s Next?
Quiz 1
3 attempts allowed
Introduction to Prompt Engineering
OpenAI GPT and Prompting: An Introduction
Generative Pre-trained Transformers (GPT) Models
What Is GPT and How Is It Different from ChatGPT?
Exercise 6
The GPT models series: a closer look
GPT-3.5
GPT-4
Other Models
Exercise 7
API Usage vs. Web Interface
Exercise 8
Tokens
Exercise 9
Costs, Tokens, and Initial Prompts: How to Calculate the Cost of Using a Model
Exercise 10
Prompting: How Does It Work?
Exercise 11
Probability and Sampling: At the Heart of GPT
Exercise 12
Understanding the API Parameters
Temperature
Top-p
Top-k
Sequence Length (max_tokens)
Presence Penalty (presence_penalty)
Frequency Penalty (frequency_penalty)
Number of Responses (n)
Best of (best_of)
Exercise 13
OpenAI Official Examples
Using the API without Coding
Exercise 14
Completion (Deprecated)
Chat
Insert (Deprecated)
Edit (Deprecated)
Quiz 2
3 attempts allowed
Setting Up the Environment
Choosing the Model
Choosing the Programming Language
Installing the Prerequisites
Installing the OpenAI Python library
Getting an OpenAI API key
A Hello World Example
Exercise 15
Interactive Prompting
Interactive Prompting with Multiline Prompt
Quiz 3
3 attempts allowed
Few-Shot Learning and Chain of Thought
What Is Few-Shot Learning?
Zero-Shot vs Few-Shot Learning
Exercise 16
Approaches to Few-Shot Learning
Prior Knowledge about Similarity
Prior Knowledge about Learning
Prior Knowledge of Data
Exercise 17
Examples of Few-Shot Learning
Limitations of Few-Shot Learning
Quiz 4
3 attempts allowed
Chain of Thought (CoT)
Exercise 18
Quiz 5
3 attempts allowed
Zero-Shot CoT Prompting
Exercise 19
Quiz 6
3 attempts allowed
Auto Chain of Thought Prompting (AutoCoT)
Exercise 20
Quiz 7
3 attempts allowed
Self-Consistency
Exercise 21
Quiz 8
3 attempts allowed
Transfer Learning
What Is Transfer Learning?
Inductive Transfer
Exercise 22
Transductive Transfer
Exercise 23
Inductive vs. Transductive Transfer
Exercise 24
Transfer Learning, Fine-Tuning, and Prompt Engineering
Exercise 25
Fine-Tuning with a Prompt Dataset: A Practical Example
Exercise 26
Why Is Prompt Engineering Vital for Transfer Learning and Fine-Tuning?
Exercise 27
Quiz 9
3 attempts allowed
Perplexity as a Metric for Prompt Optimization
Avoid Surprising the Model
Exercise 28
How to Calculate Perplexity?
Exercise 29
A Practical Example with Betterprompt
Hack the Prompt
Quiz 10
3 attempts allowed
ReAct: Reason + Act
What Is It?
ReAct Using LangChain
General Knowledge Prompting
What Is General Knowledge Prompting?
Exercise 30
Example of General Knowledge Prompting
Exercise 31
Quiz 11
3 attempts allowed
Introduction to Azure Prompt Flow
What Is Azure Prompt Flow?
Prompt Engineering Agility
Exercise 32
Considerations before Using Azure Prompt Flow
Exercise 33
Creating Your First Prompt Flow
Exercise 34
Deploying the Flow for Real-Time Inference
Quiz 12
3 attempts allowed
LangChain: The Prompt Engineer’s Guide
What is LangChain?
Installation
Getting Started
Prompt Templates and Formatting
Partial Prompting
Composing Prompts Using Pipeline Prompts
Exercise 35
Chat Prompt Templates
The Core Building Block of LangChain: LLMchain
Custom Prompt Templates
Exercise 36
Few-Shot Prompt Templates
Exercise 37
Better Few-Shot Learning with Example Selectors
NGram Overlap Example Selector
Max Marginal Relevance Example Selector
Length-Based Example Selector
The Custom Example Selector
Few-Shot Learning with Chat Models
Exercise 38
Using Prompts from a File
Validating Prompt Templates
Exercise 39
Quiz 13
3 attempts allowed
A Practical Guide to Testing and Scoring Prompts
How and What to Evaluate in a Prompt
Exercise 40
Testing and Scoring Prompts with promptfoo
promptFoo: Using Variables
promptfoo: Testing with Assertions
Exercise 41
Integration of promptfoo with LangChain
Reusing Assertions with Templates in promptfoo (Dry)
Streamlining the Test with promptfoo Scenarios
Quiz 14
3 attempts allowed
General Guidelines and Best Practices
Introduction
Start with an Action Verb
Provide a Clear Context
Use Role-Playing
Use References
Use Double Quotes
Use Single Quotes When Needed
Exercise 42
Use Text Separators
Be Specific
Give Examples
Indicate the Desired Response Length
Guide the Model
Don’t Hesitate to Refine
Consider Looking at Your Problem from a Different Angle
Consider Opening Another Chat (ChatGPT)
Use the Right Words and Phrases
Exercise 43
Experiment and Iterate
Exercise 44
Stay Mindful of LLMs Limitations
Quiz 15
3 attempts allowed
How and Where Prompt Engineering Is Used
Creative Writing
Content Generation, SEO, Marketing, and Advertising
Exercise 45
Customer Service
Exercise 46
Data Analysis, Reporting, and Visualization
Exercise 47
Virtual Assistants and Smart Devices
Game Development
Exercise 48
Healthcare and Medical
Story Generation and Role-Playing
Business intelligence and analytics
Exercise 49
Image Generation
Quiz 16
3 attempts allowed
Anatomy of a Prompt
Role or Persona
Instructions
Input Data
Context
Rules
Output
Examples
Types of Prompts
Direct Instructions
Open-Ended Prompts
Socratic Prompts
System Prompts
Other Types of Prompts
Interactive Prompts
Prompt Databases, Tools, and Resources
Prompt Engine
Prompt Generator for ChatGPT
PromptAppGPT
Promptify
PromptBench
promptfoo
Promptperfect: A Prompt Optimization Tool
Aiprm for ChatGPT: Prompt Management and Database
FlowGPT: A Visual Interface for ChatGPT and Prompt Database
Wnr.ai: A No-Code Tool to Create Animated AI Avatars
Afterword
What’s Next?
Your Feedback Matters
LLM Prompt Engineering For Developers (The Course)
The Art and Science of Unlocking LLMs' True Potential
A practical approach to Prompt Engineering for developers. Dive into the world of Prompt Engineering agility, optimizing your prompts for dynamic LLM interactions. Learn with hands-on examples from the real world and elevate your developer experience with LLMs. Discover how the right prompts can revolutionize your interactions with LLMs.
Minimum price
$129
$179
You pay
Author earns
About
About the Course
In "LLM Prompt Engineering For Developers," we take a comprehensive journey into the world of LLMs and the art of crafting effective prompts for them.
The course starts by laying the foundation, exploring the evolution of Natural Language Processing (NLP) from its early days to the sophisticated LLMs we interact with today. You will dive deep into the complexities of models such as GPT models, understanding their architecture, capabilities, and nuances.
As we progress, this course emphasizes the importance of effective prompt engineering and its best practices. While LLMs like ChatGPT (gpt-3.5) are powerful, their full potential is only realized when they are communicated with effectively. This is where prompt engineering comes into play. It's not simply about asking the model a question; it's about phrasing, context, and understanding the model's logic.
Through lessons dedicated to Azure Prompt Flow, LangChain, and other tools, you'll gain hands-on experience in crafting, testing, scoring and optimizing prompts. We'll also explore advanced concepts like Few-shot Learning, Chain of Thought, Perplexity and techniques like ReAct and General Knowledge Prompting, equipping you with a comprehensive understanding of the domain.
This course is designed to be hands-on, offering practical insights and exercises. In fact, as you progress, you'll familiarize yourself with several tools:
- openai Python library: You will dive into the core of OpenAI's LLMs and learn how to interact and fine-tune models to achieve precise outputs tailored to specific needs.
- promptfoo: You will master the art of crafting effective prompts. Throughout the course, we'll use promptfoo to test and score prompts, ensuring they're optimized for desired outcomes.
- LangChain: You’ll explore the LangChain framework, which elevates LLM-powered applications. You’ll dive into understanding how a prompt engineer can leverage the power of this tool to test and build effective prompts.
- betterprompt: Before deploying, it's essential to test. With betterprompt, you'll ensure the LLM prompts are ready for real-world scenarios, refining them as needed.
- Azure Prompt Flow: You will experience the visual interface of Azure's tool, streamlining LLM-based AI development. You'll design executable flows, integrating LLMs, prompts, and Python tools, ensuring a holistic understanding of the art of prompting.
- And more!
With these tools in your toolkit, you will be well-prepared to craft powerful and effective prompts. The hands-on exercises will help solidify your understanding. Throughout the process, you'll be actively engaged and by the end, not only will you appreciate the power of prompt engineering, but you'll also possess the skills to implement it effectively.
Instructor
About the Instructor
Aymen El Amri is an author, entrepreneur, trainer, and polymath software engineer who has excelled in a range of roles and responsibilities in the field of technology, including DevOps & Cloud Native, Cloud Architecture, Python, NLP, Data Science, and more.
Aymen has trained hundreds of software engineers and written multiple books and courses read by thousands of other developers and software engineers.
Aymen El Amri has a practical approach to teaching, breaking down complex concepts into easy-to-understand language and providing real-world examples that resonate with his audience.
Some projects he founded are FAUN.dev(), eralabs.io, and Marketto. You can find Aymen on Twitter and Linkedin.
Episode 88
An Interview with Aymen El Amri
Material
Course Material
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Write and Publish on Leanpub
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.