3 Prompt Patterns: Advanced Types and Templates

 

This chapter covers

  • Advanced prompt patterns, their templates, with examples of using prompt patterns to craft effective prompts.
  • Different types of advanced prompt patterns and their templates with examples of using prompt patterns to guide models to generate accurate and relevant responses.
  • Constructing effective prompts using prompt patterns and templates with real-world examples.

In Chapter 2 we discussed the elements that form a prompt pattern, categories of prompts, and basic prompt patterns from each of the categories. In this chapter, we will extend the same categories of prompt patterns and talk about advanced prompt patterns that can help with complex tasks. We will revisit the categories of prompt patterns that we discussed in Chapter 2 and discuss a few new categories. Figure 3.1 shows the categories of prompt patterns that we are going to learn in this Chapter. For each of the categories we will discuss prompt patterns that can help you engineer and craft effective prompts to get relevant results from an LLM.

Figure 3.1 The categories of prompt patterns that we are going to learn in this chapter.

3.1 Output Customization

3.1.1 Outline Expansion Pattern

3.1.2 Semantic Filter Pattern

3.2 Prompt Improvements

3.2.1 Refusal Breaker Pattern

3.2.2 Cognitive Verifier Pattern

3.3 Interaction

3.3.1 Flipped Interaction Pattern

3.3.2 Infinite Generation Pattern

3.4 Context Control

3.4.1 Context Manager Pattern

3.5 Error Identification

3.5.1 Reflection Pattern

3.5.2 Fact Check List Pattern

3.6 Summary