Prompt library

In this article, we've collected a set of prompts that you can use to complete a wide variety of tasks on your data. Not long ago, each of these tasks would have required a specialized model. Today, diverse AI capabilities such as sentiment analysis, classification, translation, summarization, and much more are accessible through general-purpose LLMs — as long as you know which prompts to use.

We'll look at prompts designed to complete the following tasks:

  • Close-ended classification - Classify an input into a fixed set of categories.
    • Binary labeling
    • Sentiment analysis
    • Quality scoring
    • Topic classification
    • Prioritization
    • Custom closed-ended classification
  • Open-ended classification - Classify an input into an open-ended set of categories.
    • Topic modeling
    • Custom open-ended classification
  • Tagging - Label an input with1 or more categories.
    • Close-ended tagging
    • Open-ended tagging
  • Generation - Generate new content from an input.
    • Summarization
    • Translation
    • Grammer correction
    • Tone modification
    • Data extraction
    • Custom generation

The starter prompt

Effective prompts for data analysis follow a formula:

  1. Provide context about the task to be completed
  2. Clearly indicate the role that the LLM is to play in the task
  3. Define clear instructions the LLM can follow to complete the task
  4. Provide examples of to illustrate good output from the task
  5. Specify the format of a valid output

We can use this template to define a prompt that follows these best practices:

[CONTEXT - e.g, I am the product manager responsible for playlists at Spotify. My goal is to increase songs played 
per session.]

[ROLE - e.g., You are an expert in product optimization.]

[CLEAR INSTRUCTIONS - e.g., Evaluate each answer to "What would you change about Spotify?" based on the projected 
impact to songs played per session. Output "high" if the requested change will significantly increase songs 
played per session, "low" if the impact will be none or minimal, and "medium" if it will be somewhere 
in between.]

For example:
[FIRST EXAMPLE]
[SECOND EXAMPLE]
[THIRD EXAMPLE]

[FORMAT - Output only high, medium, or low.]

For example, a good prompt might look like this:

I need help rating the quality of responses to a user research question. You are a user research expert. 

I will provide a user's answer to the question: "What would you change about Spotify?". Rate the Survey Response either "Good", "OK", or "Poor". A "Poor" response contains no useful information. An "OK" response mentions a specific feature. A "Good" response mentions a specific feature and provides an explanation.

For example, a "Good" response is:
"Better integration with Apple CarPlay. I would like to be able to more easily select songs from my playlist while I'm driving."

For example, a "Poor" response is: "Haven't used it enough yet to provide feedback" or "Nothing"

Respond only with "Good", "OK", or "Poor".

Important: You can reference the name any columns included with the prompt. In this case, we're referencing the Survey Response column. The appropriate value will be inserted into the prompt for each row evaluated in the data set.

Classification

Classification involves generating a column acts as a label or category for a set of data. Often, the output of a classification prompt is a single word like yes , no , positive , negative , good , ok , poor , high , playlists , carplay , etc.

Classification can be either close-ended, meaning that the results are limited to a pre-defined set of options, or open-ended meaning that the LLM can generate new options.

Close-ended classification

Binary labeling

The most basic close-ended classification involves labeling an input with an answer to a yes or no question, such as "Is this Survey Response related to the iPhone app?". To get good results, the prompt may need examples of an affirmative vs. negative output.

For example, this prompt generates a binary label for generic prescription medication (in a column named Prescription) based on whether that medication is related to weight loss.

I need help identifying generic prescriptions that are used for weight loss treatment. You are an pharmacist. Is this Prescription used to treat Weight Loss? Output yes or no.

Examples:
Prescription: semaglutide, Output: yes
Prescription: levothyroxine, Output: no

Sentiment analysis

Sentiment analysis is the process of using natural language processing to identify and categorize the emotional tone of a text as positive , negative , or neutral . OpenAI's models are very good at this type of analysis when properly prompted, and likely don't need examples for good outputs (although examples are typically helpful).

I need your help evaluating the sentiment of App Store reviews for the Spotify app. You are an expert user researcher tasked with sentiment analysis.

Evaluate the sentiment of this Review. Output positive, neutral, or negative.

Quality scoring

Often, it's helpful to rate the quality of an input. For example, we may want to identify high quality survey responses and weed out low quality responses. Quality scoring is the process of rating the quality of content good , ok , or poor based on some criteria.

A good quality rating will depend on the context of how quality is defined. As a result, it's helpful to include detailed context, clear instructions, and examples in the prompt:

I need help rating the quality of responses to a user research question. 

Rate the response to "What would you change about Spotify?" either "good", "ok", or "poor". 
A "poor" response contains no useful information. An "ok" response mentions a specific feature. 
A "good" response mentions a specific feature and provides an explanation.

For example, a "good" response is:
"Better integration with Apple CarPlay. I would like to be able to more easily select songs from my 
playlist while I'm driving."

For example, a "poor" response is: "Haven't used it enough yet to provide feedback" or "Nothing"

Output only good, ok, or poor.

Topic classification

Topic classification involves assigning a topic to an input. For example, we could classify survey responses to question like "What change would you make to the Spotify app? into the feature areas. As we'll discuss below, its sometimes helpful to have topic classification be open-ended so that the LLM can identify new categories. However, there will be times when the topic classification should be closed-ended. Here is an example:

We need to categorize user feedback about desired changes to the Spotify app to identify common themes and prioritize potential improvements.

You are a data analyst specializing in user feedback categorization for music streaming services.

You will be given a "Survey Response" to the question: "If you could wave a magic wand, what change would you make to the Spotify app?" Your task is to classify each response into one of the following categories:

User Interface
Music Discovery
Playlist Management
Audio Quality
Social Features
Offline Functionality
Podcasts
Personalization
Device Integration
Other

Choose the category that best fits the main focus of the response. If a response touches on multiple categories, select the most prominent one. If the response doesn't fit any of the specified categories or is unclear, classify it as "Other."

Examples:
Survey Response: "I wish I could easily see which songs I've listened to the most in the past month.", Category: Personalization
Survey Response: "Better sound quality options, especially for high-end audio systems.", Category: Audio Quality

Respond only with the Category. 

Prioritization

Make a prioritization decision, high , medium , or low , based on some prioritization criteria (for example, "Rate each change request based on the likely impact to songs played per session". This type of prompt taps into the reasoning capabilities of LLMs. Context is important for a good result. For example:

I am the product manager responsible for playlists at Spotify. My goal is to increase songs played per session. 

Evaluate each answer to "What would you change about Spotify?" based on the projected impact to songs played per session. Output "high" if the requested change will significantly increase songs played per session, "low" if the impact will be none or minimal, and "medium" if it will be somewhere in between.

Output only high, medium, or low.

Prioritization requires the LLM to go through a reasoning process. This type of prompt benefits from "chain of thought" where by the LLM is encouraged to go through a process step-by-step to get to a better answer. In GPTcsv, you can implement chain of thought by adding multiple columns which build on each other.

For example, you could start by generating an explanation of why a suggested change may or may not impact songs played per session.

I am the product manager responsible for playlists at Spotify. My goal is to increase songs played per session. 

Evaluate each answer to "What would you change about Spotify?" and determine a priority ("high", "medium", or "low") based on the projected impact to songs played per session. Take into account both how much the change will impact songs played per session for a user and how many users are likely to benefit 
from that change. Assign a "high" priority if the requested change will significantly increase songs played per session, "low" if the impact will be none or minimal, and "medium" if it will be somewhere in between.

Explain: What about the requested change will or will not have a significant impact on songs played per session?

Output only the explanation, not the priority.

Then, you could generate the priority based on the original response and the explanation (remember to include both columns in the context for the prompt):

I am the product manager responsible for playlists at Spotify. My goal is to increase songs played per session.

You evaluated the answer to "What would you change about Spotify?" based on the projected impact to songs played per session and explained why the change would or would not impact songs played per session. Assign a priority ("high", "medium", or "low") based on the Explanation. Output "high" if the requested change will significantly increase songs played per session, "low" if the impact will be none or minimal, and "medium" if it will be somewhere in between.

Output only high, medium, or low.

This approach breaks the prioritization step into two parts: 1) a reasoning about the impact to the songs played per session and 2) determining priority based on that reasoning.

Custom close-ended classification

Prompts can be designed to do any type of close-ended classification. For example, this prompt uses the name, firm, and other details about a VC investor to assign a Tier 1 , Tier 2 , and Tier 3 label to an investor to help prioritize outreach:

Rate this Investor Tier 1, Tier 2, or Tier 3. A Tier 1 investor is from a well-known firm like Benchmark or a16z or has a strong public presence. A Tier investor is relatively unknown. Respond only with "Tier 1", "Tier 2", "Tier 3", or "Not sure".

Open-ended classification

Prompts that classify content into a small, but open-ended set of options. For example, classifying a survey response into a feature area such as playlists , carplay , mobile , etc. Acceptable responses are likely limited to 20 or so options. Too few options will be less useful for segmenting the data, especially with large data sets. Too many options get unwieldy to deal with.

These responses would benefit from some post-processing to make sure there aren't too many different classification categories and/or to aggregate low frequency results into an other category.

The most common open-ended classification task is Topic clustering where we ask generate topics based on a piece of content such as a survey response.

Tagging

Tagging is similar to classification. However, instead of responding with a single label, tagging prompts respond with a common-separated list of all labels that apply or none if no label applies. Like classification, tagging can be either closed-ended, meaning that only labels from a pre-defined set can be selected, or open ended meaning that the LLM can generate new labels as necessary.

Some post-processing would be helpful to make sure that the comma-separated list is properly formatted, that the list has a minimum or maximum number of elements, and that the list items are within a pre-defined set.

Open-ended tagging example (fixed length)

I'm going to Input the name of a prescription medication. Output the top three conditions treated by that 
prescription medication as a comma separated list. For example:
Input: prednisone
Output: allergic reactions, autoimmune disorders, inflammation

Open-ended tagging example (variable length)

I'm going to Input the name of a generic prescription medication. Output the US brand names, as a 
comma separated list, under which that medication is sold.
For example:
Input : prednisone
Output: Deltasone, predniSONE Intensol, Rayos, Sterapred, Sterapred DS

Generation

Summarization

You are an expert content summarizer, skilled at distilling complex articles into their core message.

You will be given the full text of a Blog Article. Your task is to create a summary that captures the main point or key takeaway of the article in 1-2 sentences. The summary should:

Identify the central theme or argument of the article
Include any crucial supporting points if space allows
Be clear and easy to understand
Maintain a neutral tone
Not include any information not present in the original article

Avoid using phrases like "This article discusses" or "The author argues". Instead, present the summary as a stand-alone statement of the article's core content.

Output only the summary.

Grammar correction

We need to improve the grammatical accuracy of user-submitted text.

You are a professional editor with expertise in English grammar and writing.

You will be provided with a Description that may contain grammatical errors. Your task is to correct any grammatical mistakes while preserving the original meaning and tone of the text. Focus on fixing issues such as subject-verb agreement, verb tense consistency, pronoun usage, sentence structure, and punctuation. Do not alter the content or style of the writing beyond what is necessary for grammatical correctness.

Examples:
Input: "I goes to the store yesterday and buyed milk.", Corrected: "I went to the store yesterday and bought milk."
Input: "The team are working hard to finish the project on time.", Corrected: "The team is working hard to finish the project on time."

Output only the corrected text.

Translation

We need to accurately translate product descriptions from English to Spanish for our e-commerce platform.

You are a professional translator specializing in English to Spanish translations, with expertise in e-commerce and product descriptions.

You will be given a product "Description" in English. Your task is to translate this description into Spanish. The translation should:

Accurately convey the meaning of the original text
Use natural, fluent Spanish appropriate for a general audience
Maintain the tone and style of the original description
Correctly translate any technical terms or product-specific vocabulary
Adapt any culturally specific references or idioms as needed
Preserve formatting elements like bullet points or paragraph breaks

Do not add or remove information from the original description. If there are brand names or product names, keep these in their original form unless there is a widely accepted Spanish version.

Examples:
Description: "Our lightweight running shoes feature breathable mesh and responsive cushioning for ultimate comfort on long runs.", Translation: "Nuestras zapatillas de correr ligeras cuentan con malla transpirable y amortiguación receptiva para una comodidad máxima en carreras largas."
Description: "This stainless steel water bottle keeps drinks cold for 24 hours or hot for 12 hours. Perfect for outdoor adventures!", Translation: "Esta botella de agua de acero inoxidable mantiene las bebidas frías durante 24 horas o calientes durante 12 horas. ¡Perfecta para aventuras al aire libre!"

Respond with your Translation.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us