ChatGPT Prompt Framework
After reading the introduction of various scenarios in the basic chapter, you should have a deep understanding of prompts. In the previous chapters, we talked about the so-called "art" of prompt engineering, focusing more on how to use prompts, but not much about the specific techniques involved.
In this chapter, we will discuss two popular prompt frameworks: the Elavis Saravia framework and the CRISPE framework.
The Elavis Saravia framework is a simple and easy-to-follow framework for writing prompts. It consists of four elements:
- Instruction: This is the specific task that you want the model to perform. For example, you might want the model to generate text, translate languages, or write different kinds of creative content.
- Context: This is the background information that the model needs to understand your request. For example, if you are asking the model to generate text about a specific topic, you would need to provide the model with information about that topic.
- Input data: This is the data that the model needs to process. For example, if you are asking the model to translate a sentence from English to French, you would need to provide the model with the English sentence.
- Output indicator: This is a signal to the model about the type or format of output that you are expecting. For example, if you are asking the model to generate text, you might specify that you want the output to be a paragraph of text.
Here is an example of a prompt that uses the Elavis Saravia framework:
Prompt (Generate text about Internet history):
Instruction: Generate a paragraph of text about the history of the internet. Context: The internet is a global system of interconnected computer networks that use the standard Internet Protocol Suite (TCP/IP) to serve billions of users worldwide. It is a network of networks that consists of millions of private, public, academic, business, and government networks, of local to global scope, that are linked by a broad array of electronic, wireless and optical networking technologies. The Internet carries a vast range of information resources and services, such as the inter-linked hypertext documents and applications of the World Wide Web (WWW), electronic mail, telephony, and file sharing. Input data: None. Output indicator: Paragraph of text.
The CRISPE framework is a more complex but more complete framework for writing prompts. It consists of five elements:
- Capacity and role: This is the role that you want the model to play. For example, you might want the model to act as an expert, a creative writer, or a comedian.
- Insight: This is the background information and context that the model needs to understand your request.
- Statement: This is the specific task that you want the model to perform.
- Personality: This is the style or manner in which you want the model to answer your request.
- Experiment: This is a request for the model to provide multiple answers.
Here is an example of a prompt that uses the CRISPE framework:
Prompt (Generate text about machine learning frameworks):
Capacity and role: Act as an expert on machine learning frameworks. Insight: The audience for this blog is technical professionals who are interested in learning about the latest advancements in machine learning. Statement: Provide a comprehensive overview of the most popular machine learning frameworks, including their strengths and weaknesses. Include real-world examples and case studies to illustrate how these frameworks have been successfully used in various industries. Personality: Use a mix of the writing styles of Andrej Karpathy, Francois Chollet, Jeremy Howard, and Yann LeCun. Experiment: Provide me with multiple different examples.
The Elavis Saravia framework and the CRISPE framework are two popular prompt frameworks that can be used to improve the results of your prompts. By following these frameworks, you can ensure that your prompts are clear, informative, and effective.