5 Specific Tips for High-Impact ChatGPT Prompt Engineering
As an IT professional, you've likely seen or heard about ChatGPT in the news. This impressive artificial intelligence (AI) model has numerous applications, and its potential is only limited by the way you interact with it. This article provides you with five specific tips for high-impact ChatGPT prompt engineering. But first, let's briefly discuss what ChatGPT is and what prompt engineering entails.
Understand ChatGPT and Prompt Engineering
ChatGPT is a large language model (LLM) developed by the hybrid non-profit/for-profit organization OpenAI, based on their generative pre-trained transformer (GPT) machine learning (ML) model. GPT was designed to generate human-like text responses by understanding and processing input prompts.
Prompt engineering is the process of crafting these input prompts to elicit the desired output from the AI model. Effectively, it's how you communicate with ChatGPT and make it work for you. Stated another way, prompt engineering is how you "program" GPT and ChatGPT.
Note: GPT is the parent ML model to ChatGPT (intended for conversational AI), Codex (aimed at source code generation), and DALL-E (meant for image generation). For more information, consult the excellent OpenAI documentation.
Now, let's dive into the five tips that will help you elevate your prompt engineering skills with ChatGPT.
Role Assignment: Directing ChatGPT's Function
Assigning ChatGPT a role is a crucial step in making the AI model more focused and effective. By giving it a specific identity or function, you guide its responses to match the context of that role. For example, assigning ChatGPT the role of a technical support assistant will yield responses geared toward helping users troubleshoot their issues.
To assign a role, start your prompt with an instruction that clearly states the role you want ChatGPT to assume. Here's an example:
You are a technical support assistant. Help the user fix their Wi-Fi connection issues by asking a series of questions and acting on the responses.
This will direct ChatGPT to respond in a manner consistent with a technical support assistant. It's important to not only be explicit and potentially verbose in your original prompt, but also your follow-up responses. Remember that ChatGPT saves the state of each conversation, meaning the AI remembers everything it told you and everything you told it. Take advantage of this benefit!
Let's look at another example, this time adapted from the Awesome ChatGPT Prompts GitHub repository. In this one, ChatGPT takes the role of a technical hiring manager for a Microsoft Azure Cloud Solution Architect position. I know people who use this prompt for real-world technical interview preparation!
I want you to act as an interviewer. I will be the candidate and you will ask me the interview questions for the position "Microsoft Azure Cloud Solutions Architect." I want you to only reply as the interviewer. Do not write all the conservation at once. I want you to only do the interview with me. Ask me the questions and wait for my answers. Do not write explanations. Ask me the questions one by one like an interviewer does and wait for my answers. After giving me six questions, review my responses and provide detailed, constructive feedback. My first sentence is "Hello."
Illustrate With Examples: Guiding ChatGPT's Output
Providing examples in your prompts is an excellent way to guide ChatGPT's output and ensure it aligns with your desired format or style. Including specific examples within your prompts helps the AI model better understand the context and tailor its responses accordingly.
For instance, if you want ChatGPT to generate a list of suggestions, you can provide an example like this:
List five ways to improve my MEAN stack website's performance, similar to the following example: 1. Optimize images by compressing and resizing them. Provide detailed justifications for each way.
This prompt informs ChatGPT of the desired format and guides it towards providing a list of suggestions in a similar style:
Write a PowerShell script that lists the current machine's uptime. Provide the output in the following format:
Constraints and Limitations: Streamlining ChatGPT's Responses
Sometimes, you may want ChatGPT to provide a response within specific constraints or limitations. To achieve this, include these constraints directly in your prompt. For example, if you want a concise answer, specify a word limit:
Explain the concept of machine learning in 50 words or less. The audience is a typical American high school student.
This will guide ChatGPT to provide a brief yet informative response while adhering to the constraint you've set. Here's another prompt in which you instruct ChatGPT to summarize an article you paste into the chat application:
Summarize the following article in 150 words. Avoid technical and marketing jargon. The audience is business worker with intermediate technical knowledge and skills. "<pasted-article-text>"
If you're fortunate enough to have access to the GPT-4 Extended model with a 32,000 token limit, you can submit many, many pages of text to the AI for processing. For the rest of us, keep in mind the GPT-4 model has a maximum token length of 4,096. If you don't know, a token is a word fragment; the token length spans the words in your prompt and ChatGPT's completion, combined.
Thus, if you're too verbose with your prompt, ChatGPT may truncate its completion. If that happens, however, simply prompt "Continue" or "Pick up where you left off" to instruct ChatGPT to continue its response.
Step-by-Step Instructions: Encouraging Sequential Output
When you require a response in a step-by-step format, explicitly request it in your prompt. By doing so, you encourage ChatGPT to generate a response that follows a logical sequence of steps.
Explain the process of setting up a secure home Wi-Fi network in five simple steps.
This prompt guides ChatGPT to provide a response that follows a step-by-step approach, making it easier for the end user to understand and follow.
Here's another example, again from the Awesome ChatGPT Prompts repo. Here you have ChatGPT role-play as a technical writer explaining a stepwise procedure:
Act as a tech writer. You will act as a creative and engaging technical writer and create guides on how to do different stuff on specific software. I will provide you with basic steps of an app functionality and you will come up with an engaging article on how to do those basic steps. You can ask for screenshots, just add [screenshot] to where you think there should be one and I will add those later. These are the first basic steps of the app functionality: "1.Click the Download button depending on your OS platform. 2.Install the software. 3.Double-click the Desktop icon to open the app"
Iterate and refine: Perfecting your prompt engineering
Prompt engineering is an iterative process. To achieve the desired output, you may need to refine your prompts multiple times. By testing different prompt variations and analyzing their respective outputs, you can identify the most effective approach.
For example, if a prompt yields an unsatisfactory response, you can modify it by adding more context or examples. Alternatively, you can make the prompt more explicit or concise, depending on the issue you've encountered.
Consider this initial prompt:
What are the benefits of using a VPN?
If the response isn't detailed enough, you can refine the prompt by adding context or specific points to cover:
Explain the benefits of using a VPN, including aspects such as privacy, security, and bypassing geo-restrictions.
Iterating and refining your prompts will help you hone your prompt engineering skills and improve the quality of the AI-generated responses.
Effective ChatGPT prompt engineering can significantly enhance the AI model's utility and performance. By assigning a role, providing examples, setting constraints, encouraging step-by-step instructions, and iterating through refinements, you can ensure your prompts elicit the desired output from ChatGPT. As an IT professional, mastering these skills will allow you to harness the full potential of this powerful AI tool, ultimately improving the efficiency and effectiveness of your work.