Prompts & Prompt Engineering
Prompt Basics & Structure
This lesson covers the basics of building effective prompts for Large Language Models (LLMs). We'll explore how to structure prompts to get improved results and understand the importance of breaking down complex tasks into smaller, manageable components. We'll also discuss how to use LLMs sequentially to get improved results.
Why It Matters
Understanding prompt basics and structure is crucial in the real world of AI because it enables us to solve complex problems by breaking them down into smaller, manageable tasks. This allows us to leverage the power of LLMs to generate high-quality results. By mastering prompt structure, we can automate tasks such as content creation, data analysis, and decision-making.
Key Points
Key Concepts
A Large Language Model that tries to predict the words that might follow it based on a certain input.
A prediction machine that tries to predict the words that might follow it based on a certain input.
A technique for asking specific questions of an LLM to get a specific result.
A technique for creating multiple prompts in parallel and merging them to get a final result.
A technique for helping LLMs remember what was being said in a conversation.
Code Examples
Create a prompt template with the 'input_prompt' variable
template = "<s><|user|> {input_prompt}<|end|> <|assistant|>"
Create a chain for the character description using the summary and title
template = "<s><|user|> Describe the main character of a story about {summary} with the title {title}. Use only two sentences.<|end|> <|assistant|>"
From the books
Quick Quiz
1. What is a basic ingredient of a prompt?
2. What is a technique for creating multiple prompts in parallel and merging them to get a final result?
3. Why do LLMs need help remembering what was being said in a conversation?