Skip to main content

How to Craft Perfect Prompts for ChatGPT?


ChatGPT is an artificial intelligence system that can generate text responses based on user inputs. It can be used for various purposes, such as chatting, writing, learning, and more. However, to get the most out of ChatGPT, users need to know how to craft perfect prompts that will elicit useful and relevant answers from the system.

A prompt is a text input that tells ChatGPT what kind of response you want from it. A good prompt should be clear, specific, and informative. It should also state your intent or goal, and direct the output format if needed. In this essay, I will share seven best practices for effective prompt engineering, and then I will give you a formula and some examples of perfect prompts.


Best Practices

1. Be specific

If you ask a vague question, you may get a vague answer. The more details you provide, the better ChatGPT can give you what you’re looking for. For example, instead of asking "tell me about all dog breeds that exist,” ask “What are the different breeds of small dogs suitable for apartment living?” This way, ChatGPT can narrow down its search and generate more relevant information.

2. State your intent

If there’s a specific purpose for your question, state it in the prompt. For example, instead of asking “explain quantum physics” you could say “I’m helping my fifth-grade son with his science homework. Could you explain quantum physics in a simple way?” This way, ChatGPT can adjust its tone and level of complexity to suit your audience and goal.

3. Use correct spelling and grammar

While ChatGPT can often interpret and correct spelling and grammar mistakes, providing clear and correct prompts helps ensure you get the best response. ChatGPT may also use your spelling and grammar as cues for the style and quality of the output. For example, if you write “how r u?” ChatGPT may respond with “im good thx” or something similar.

4. Direct the output format

If you want the answer in a specific format, state it in your question. For example, you could ask “Could you list the steps to bake a chocolate cake?” or “Could you explain the process of baking a chocolate cake in a paragraph?” This way, ChatGPT can structure its response accordingly and avoid confusion or ambiguity.

5. Ask follow-up questions

If the response wasn’t what you expected or if you need more information, feel free to ask follow-up questions to clarify. ChatGPT can remember the context of the previous prompts and responses and use them to generate more coherent and consistent answers. For example, if you ask, “What are the benefits of meditation?” and ChatGPT responds with “Meditation can help reduce stress, improve focus, and enhance well-being.” You could then ask, “How long should I meditate each day?” or “What are some good meditation techniques?”

6. Experiment with different phrasings

If you’re not getting the response you want, try asking the question in a different way. ChatGPT might understand one phrasing better than another, or generate different answers based on different wordings. For example, if you ask, “What is the meaning of life?” ChatGPT may respond with “That is a very deep and philosophical question that has no definitive answer.” But if you ask, “What gives life meaning?” ChatGPT may respond with “Life is what you make of it. You can find meaning in your relationships, your passions, your goals, and your values.”

7. Prompt for fact-checking

If you’re looking for reliable information, you can ask ChatGPT to provide sources or to fact-check information. For example, “Can you fact-check this statement: The tallest mountain in the world is Mount Everest?” ChatGPT may respond with “This statement is true according to most measurements, but some people argue that other mountains are taller based on different criteria. For example, Mauna Kea in Hawaii is taller than Mount Everest if measured from its base on the ocean floor.” ChatGPT may also provide links or references to support its claims.

Formula

Now that you know the seven best practices for effective prompt engineering, let me give you a formula for crafting perfect prompts for ChatGPT.

[Context] + [Specific Information] + [Intent/Goal] + [Response Format] = Perfect Prompt

The context is the background or situation that sets up your question. The specific information is the details or parameters that narrow down your question. The intent or goal is the purpose or objective that motivates your question. The response format is the structure or style that you want ChatGPT to use in its answer.

Here are two examples of perfect prompts using this formula.

Context: “I’m a beginner cook” 
Specific Information: “trying to make Italian cuisine” 
Intent/Goal: “Can you provide a simple and easy to follow recipe.” 
Response Format: “Write it as a step-by-step list?” 
Perfect Prompt: “I’m a beginner cook trying to make Italian cuisine. Can you provide a simple and easy to follow recipe for spaghetti carbonara? Write it as a step-by-step list.”

Context: “I’m a software developer” 
Specific Information: “working on a Python project” 
Intent/Goal: “Can you explain how to implement exception handling in Python?” 
Response Format: Write it in a simple paragraph or list. 
Perfect Prompt: "I’m a software developer working on a Python project. Can you explain how to implement exception handling in Python? Write it in a simple paragraph or list.

Conclusion

In conclusion, crafting perfect prompts for ChatGPT can help you get more useful and relevant answers from the system. By following the seven best practices and using the formula I shared, you can improve your prompt engineering skills and get the most out of ChatGPT.


Comments

Popular posts from this blog

Unlock protected blocks in Siemens SIMATIC Step 7

Recently I'd been called by Hindalco's Fabrication Plant division to unlock the protected blocks in Siemens SIMATIC Step 7. They were in need to unlock those blocks since an year because of 1 million Rupees of loss per month. They want to re-program those blocks but it was locked by the man who'd done the setup. From the people working in that department, I came to know that they were trying to call that man (someone from Italy) right here but he's not coming. Actually, what he'd done was that he'd locked some of the blocks and deleted the source file. And Siemens didn't provide any feature to unlock. Department people also told me that even the people working in Siemens don't know how to do it. Being a software engineer I know that any thing can be reverse engineered. So I took up the challenge. How did I unlocked the blocks? The first thing I'd done was searched about this software at Google and read about what is this software all about. Aft

App: Calculate your job experience or age in years

Usually, all of those who works have to put years of experience on their resume or curriculum vitae. But 90% people put it wrong when they convert their experience in years only. Although they know the exact number of months and years but the conversion, they do is wrong. This happens because there are 12 months while the digit after decimal would be 0-9, i.e., 10 digits. Which means that we have to represent the number of months in terms of year. So here I have provided a small gadget to calculate it. Just put the date when you had started working in the From Date field and put current date in the To Date field. You can also calculate your age as well with this tool by putting your date of birth in the From Date field and put current date in the To Date field. As an alternative, you can use the hassle-free and simple to use  Date Differentiator  micro webapp. Bookmark it so you may easily access it later.

How to convert JIRA story into sub-task or defect?

Many times we entangled in the situation where we have made a  story  in JIRA but later on realised that it should have to be  defect  or in other case,  sub-task  of another  story . Story → Sub-task So the workaround for converting the story into defect is given below: Open your  story Click on  more  option Click on the  Convert to sub-task  option in the dropdown You would be asked to choose  Parent  story, so chose relevant story After submit, your  story  gets converted into  sub-task Story → Defect Now if you want the story to be converted into defect, then you should first convert it into sub-task. Thereafter, you can convert that sub-task into defect as given below: Open the  sub-task Click on  more  option Click on the  Convert to issue  option in the dropdown You would be asked to fill up relevant fields required for raising a  defect , fill them up as required After submit, your  sub-task  gets converted into  defect .