Prompt Engineering Examples

Text Summarization

Text summarization is a key aspect of natural language generation. It involves condensing larger bodies of text into shorter, more digestible summaries. For instance, if you’re curious about antibiotics, you could ask the model to explain it to you. The model might provide a detailed explanation, but if you want a more concise summary, you can instruct the model to condense the information into a single sentence.

[text to summarize copied from elsewhere]

Please summarize the above text:

Information Extraction

Language models are also adept at extracting specific information from a given text. For example, if you provide a paragraph and ask the model to identify a specific product mentioned, it can do so accurately.

[text to extract information from copied from elsewhere]

Please identify the key factors in the above report:

Question Answering

The model can also answer specific questions based on a given context. By providing a structured prompt that includes instructions, context, and a question, the model can generate a concise and accurate answer.

[context text]

Please use the above text to answer this question: [Question about above text].

Text Classification

The model can also classify text based on instructions provided in the prompt. For instance, it can classify a given text as neutral, negative, or positive. If you need the model to provide the label in a specific format, you can provide examples in the prompt to guide the model’s output.

[input text]

Please tell me if the above response was positive, neutral, or negative:

Conversation

You can also use the model to generate conversational responses. By providing a role for the model (e.g., an AI research assistant), and specifying the tone of the responses (e.g., technical and scientific), you can guide the model’s behavior in the conversation.

[sample email text]

Please suggest 3 different responses to the above email:

Code Generation

The model can generate code based on instructions provided in the prompt. For example, you can ask the model to write a simple program that greets the user, or a more complex MySQL query based on a given database schema.

Please write a simple program in Python that greets the user and asks how they are doing.

Reasoning

While current language models struggle with tasks that require reasoning, they can perform basic arithmetic tasks. However, for more complex reasoning tasks, you might need to provide more detailed instructions and examples in the prompt.

Riddle: What has to be broken before you can use it?

Can you solve the above riddle?

GPT-4’s response:

The answer to the riddle is “an egg”. An egg has to be broken before you can use it for cooking or eating.

Edit Template
Scroll to Top