2 Prompt engineering with ChatGPT

 

This chapter covers

  • Structuring a good prompt to make the most of ChatGPT
  • Distinguishing between zero-shot, one-shot, and few-shot prompts
  • Examining role prompting and how can it help you become a ChatGPT power user
  • Determining how to use ChatGPT’s Custom Instructions feature for a tailored user experience

This chapter will teach you the art of prompt engineering, allowing you to harness the full potential of LLMs. We will delve into practical examples and real-world applications of various prompt engineering techniques, and I encourage you to follow alongside the presented content. This hands-on approach ensures that you not only learn the theoretical aspects of prompt design but also its practical application. By the end of this chapter, you will have a strong enough understanding of prompt engineering to tailor ChatGPT’s responses to your specific tasks and use cases.

2.1 Structuring a good prompt

In the previous chapter, we briefly looked at a simple example highlighting the difference between a good prompt and a bad one. These four essential features define an effective prompt: clarity, specificity, instruction, and assumptions.

2.1.1 Clarity

 
 
 
 

2.1.2 Specificity

 

2.1.3 Instruction

 
 

2.1.4 Assumptions

 
 

2.1.5 Recap

 
 
 

2.2 Zero-Shot, One-Shot, and Few-Shot prompts

 

2.2.1 Zero-Shot prompts

 

2.2.2 One-Shot prompts

 
 
 

2.2.3 Few-Shot prompts

 
 
 
 

2.2.4 Reasons to use Few-Shot prompts

 
 
 
 

2.3 Introduction to role prompting

 
 
 

2.4 Custom instructions for better responses

 
 
 
 

2.4.1 Information for personalized responses

 
 

2.4.2 Preferred response style

 
 
 
 

2.5 Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest