avatarJacklyn Parrish

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

7645

Abstract

ract more with AI models like GPT-3, you’ll find situations where you want to obtain specific data in a structured format, be it in JSON, XML, or HTML format. Such kinds of output can be valuable for processing the data further in some applications or maintaining uniformity.</p><p id="74c9">But how can you get the AI to provide this? Like we’ve learned before, it all lies in how you craft your prompt!</p><p id="20b1">When asking for structured output, it’s helpful to:</p><ol><li>Make your request explicit, clearly stating the format you want.</li><li>Provide a template or example if possible, showing the model what you expect.</li></ol><p id="ceda">For instance, if you want the AI to generate a weekly diet plan in JSON format, frame your prompt like this:</p><p id="98f9">“Generate a weekly diet plan for a vegetarian, aged 30 with a moderately active lifestyle. The plan should be in JSON format like this:</p><div id="6433"><pre>{ <span class="hljs-string">"Monday"</span>: { <span class="hljs-string">"Breakfast"</span>: <span class="hljs-string">"<meal>"</span>, <span class="hljs-string">"Lunch"</span>: <span class="hljs-string">"<meal>"</span>, <span class="hljs-string">"Dinner"</span>: <span class="hljs-string">"<meal>"</span> }, ... }</pre></div><p id="79b5">Please replace <code><meal></code> with appropriate vegetarian dishes."</p><p id="aeae">By being clear and explicit in your instructions, you guide the AI model to provide responses in the desired structured format.</p><p id="e711">Keep in mind that while GPT-3 is powerful, it might not get these complex prompts perfect every time. Some trial and error might be needed to further refine your prompts and get the exact output.</p><p id="0c30">Remember, practice makes perfect! Keep experimenting with new ideas and see what works best for you.</p><p id="985b">Developing the ability to have AI models respond in specified, structured formats can offer numerous benefits, especially when attempting to integrate AI into an existing system. When data is structured, it can be effortlessly parsed programmatically, which provides more straightforward data manipulation and extraction.</p><p id="b357">Here are some points to consider when writing prompts for structured responses:</p><ul><li><b>Specify the Schema:</b> If you’re expecting a particular schema (such as JSON), spell it out in your prompt. GPT-3 doesn’t implicitly know the expected format unless it is told.</li><li><b>Offer Examples:</b> Teaching by example is incredibly effective. The more precise the examples you provide in your prompt, the more likely GPT-3 will be able to understand and generate appropriately structured responses.</li></ul><p id="a2f5">For instance, consider the below prompt:</p><p id="622d">“Please provide a description of a horse in the following JSON format:</p><div id="81e4"><pre><span class="hljs-punctuation">{</span> <span class="hljs-attr">"Animal"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span> <span class="hljs-attr">"Type"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"<type>"</span><span class="hljs-punctuation">,</span> <span class="hljs-attr">"Color"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"<color>"</span><span class="hljs-punctuation">,</span> <span class="hljs-attr">"Size"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"<size in lbs>"</span> <span class="hljs-punctuation">}</span> <span class="hljs-punctuation">}</span></pre></div><p id="c430">In the case mentioned above, the AI would understand that you require the data in a specific JSON structure and respond accordingly.</p><p id="ad09">Remember, don’t get discouraged if the first few prompts you write don’t work as you expect! With some practice and refinement, you’ll gain a better understanding and can tap into the powerful capabilities of AI to get highly precise and structured outputs.</p><h1 id="f69b">Topic 1.4 Including Style Information</h1><p id="a0d2">An impactful aspect of prompt design is the inclusion of style information, which can significantly modify the style or tone of the AI’s outputs.</p><p id="6b6b">Powerful AI models like GPT-3 have a broad understanding of language style and can vary their response based on the style information provided in the prompt. Whether you desire a formal tone, a casual conversation, or an old-timey Shakespearian dialogue, the model can usually adapt its output accordingly.</p><p id="15f5">Including style information allows you to:</p><p id="d874"><b>Create Engaging Content</b>: By instructing the AI to write in a certain style, you can make the output more engaging and relatable to the intended audience. For instance, if you’re creating content for children, you might instruct the AI to ‘write in a storytelling style suitable for a 10-year-old’.</p><p id="0ebf"><b>Suit Specific Requirements</b>: There are scenarios where you need the output to follow certain stylistic guidelines (like writing a technical report or creating rhyming poetry). In such cases, specifying the style can guide the AI to generate more suitable outputs.</p><p id="a195"><b>Control Tone</b>: Including style information can allow you to control the general tone (humorous, serious, playful, etc.) of the generated content.</p><p id="4e2b">For example, look at how drastically the response changes with a slight change in style information:</p><p id="0330">Prompt: “Translate the following phrase into a Shakespearean style: ‘I’m sorry, but I can’t assist with that.’”</p><p id="15cf">The AI, given its knowledge of classical English from the model it was trained on, could generate a response like: “Marry, mine assistance thou seeketh cannot be lent.”</p><p id="dc36">Prompt: “Translate the following phrase into a robotic style: ‘I’m sorry, but I can’t assist with that.’”</p><p id="71de">Given that robots are typically depicted with straightforward, emotionless speech, the AI might respond with: “Apologies. Assistance protocol not found.”</p><p id="19e8">Like all other aspects of prompts, mastering the use of style information might require some trial and error. But with practice, you’ll be able to harness this tool effectively to improve your interactions with AI even further.</p><p id="e4f7">We discussed before how including style instructions can influence the tone and format of the AI output. Now, I’ll elaborate a bit more on how we can make the most of this technique:</p><ul><li><b>Clear and Specific Instructions:</b> The effectiveness of your style instruction heavily relies on its clarity and specificity. The more explicit and detailed your instruction is, the more likely the AI can generate a response in your desired style.</li><li><b>Use of Examples:</b> Providing an example can be incredibly helpful, especially when dealing with highly stylized or specialized types of writing. For instance, you might ask the AI to “Write a conclusion for an argumentative essay, similar in style to Martin Luther King Jr.’s ‘I Have a Dream’ speech.”</li><li><b>Tonal Balance Adjustment:</b> While you can ask the AI to produce output that is humorous, sarcastic, or whimsical in nature, it’s necessary to ensure that the tonal balance you’re aiming for is suitable for your intention. Avarice, but not all topics or scenarios may suit a heavy-handed style.</li></ul><p id="971e">In a nutshell, the usage of proper style instructions serves as a powerful tool to instruct the AI effectively.

Options

When used correctly, it can help evoke a desired emotional response from the reader, serve a specific user group, or fit a specific narrative requirement. However, it’s always important to consider the relevance of the style to your specific purpose and factor this into your prompts during the construction phase.</p><h1 id="b3f0">Topic 1.5: Setting Conditions for the Model</h1><p id="a301">Setting conditions for the model in your prompts can be a useful strategy to get the output you desire. These conditions can be as explicit as asking for certain information to be included, withholding other information or specifying the format that you would like your output in.</p><p id="189b">Here are some examples:</p><ul><li><b>Defining Output Structure:</b> You might instruct the AI to “Write a poem about Winter in a 5–7–5 Haiku format.”</li><li><b>Limiting Information:</b> By asking “Can you list some actors who have played the role of James Bond, but don’t include Sean Connery?”, the model is guided to omit certain information.</li><li><b>Adding Constraints:</b> For example, “Write a story about a girl who finds a treasure map, but make it so that the story does not involve any kind of travel.”</li></ul><p id="a337">While these are useful and can help you get more specific output, you should be aware that setting too many conditions, or ones that are hard to reconcile with each other, might pose challenges for the model to generate a suitable output.</p><p id="b1f6">Setting conditions for the AI can act like a filter for the response you receive. It’s a way of guiding the AI’s response, directing it to generate a more precise output that aligns with your expectations:</p><p id="86de"><b>Positive vs. Negative Conditions</b>: You can set both positive and negative conditions for the AI. Positive conditions inform the AI of what “to do”, while negative conditions instruct what “not to do”. For example, you might ask the AI to suggest vacation spots excluding those in Europe (a negative condition).</p><p id="fe1d"><b>Complex Conditions</b>: You can also set complex conditions combining several requirements. Be mindful, though, of not overwhelming the model with too many constraints as it might affect the fluency of the output.</p><p id="f7bc"><b>Conditional Iterations</b>: Sometimes, you might need the model to generate iterations meeting a certain condition. For example, “Generate ten unique username ideas starting with ‘Blue’ and ending with a two-digit number”.</p><p id="ba0c"><b>Graphical Representations</b>: In some cases, prompts might include conditions about graphical representation of the data. For example, “Create a pie chart to visualize the percentage distribution, but make sure no individual sector is smaller than 5%.”</p><p id="de5d">While setting conditions, specificity is crucial. It’s equally important not to overdo it as that might constrain the model excessively. It’s about finding the right balance to get high-quality and precise responses from the AI.</p><h1 id="59ea">Topic: 1.6 Review and Assessments</h1><p id="feaa">We’ve gone over a plethora of strategies and inputs to craft effective AI prompts — from understanding their important parts to setting conditions. Now, it’s time to put these ideas to the test:</p><ol><li><b>Self-Evaluation:</b> Using the concepts we’ve studied so far, draft a few prompts for various tasks. An engaging story, a data extraction request, and a structured output request from an AI model are a few good ones to try out.</li><li><b>Critique and Adjustment:</b> Review your prompts — are they clear, specific, and organized? Do they effectively direct the AI model towards the results you want? If not, use your understanding of good prompt design to adjust them accordingly.</li><li><b>Modeling Test:</b> Present your prompts to the AI model, and assess the outputs. Do the responses align with your desired output? If not, analyze where the model went off track — was the prompt not specific enough, or were the necessary conditions not set?</li><li><b>Iteration:</b> Based on the model’s responses, iterate on your prompts. Refine them, adjust their specificity, add or modify delimiters, or even adjust the expected output format.</li></ol><p id="b9eb">Remember, while AI prompt crafting may seem straightforward, mastering it is an iterative process. It takes practice and a profound understanding of how an AI model interprets and responds to the prompts.</p><p id="8bf1">Don’t worry if you don’t perfect it right off the bat. The beauty of learning lies in growth, and with time and practice, you’ll be crafting powerful and effective prompts!</p><p id="a8d1">let’s move forward with some examples and exercises as part of your self-assessment. This will give you a chance to apply the principles we’ve discussed throughout this curriculum.</p><p id="5772">Here are a few task prompts for you to try out:</p><p id="3b26"><b>Task1:</b> Try to compose a prompt where you ask the AI model to generate a short story about a brave little toaster in a fantasy world full of appliances. Remember to specify the needed plot points and the ruling conditions.</p><p id="680f"><b>Task2:</b> Write a prompt that asks the AI model to extract specific data from a text. For example, abstract all dates and names mentioned in a selected paragraph.</p><p id="1364"><b>Task3:</b> Create a prompt instructing the AI model to respond with a structured output, perhaps directions for a recipe, timeline of an event, or the steps to troubleshoot a computer.</p><p id="0f62">Remember, there are no outright ‘wrong’ answers, and these exercises are designed to help you understand the art of crafting effective prompts better. Take your time, remember the strategies we’ve discussed, be creative, and have fun!</p><p id="3048"><b>Try it yourself and slide down. Below are my answers:</b></p><p id="6042"><b>Task1: Short Story Prompt</b></p><p id="e899">Prompt: “Hello AI! Can you write a short story about a brave little toaster living in a fantastic world of appliances? The story should start with the toaster waking up to a normal day when an unexpected event shakes their world. The toaster then unites the appliances to solve a problem, showing signs of bravery and wisdom. The story ends on a positive note with toaster who learns a valuable lesson. Let your creativity reign, but remember to incorporate thrill and bits of humor in the tale.”</p><p id="aef7"><b>Task2: Data Extraction Prompt</b></p><p id="eeee">Prompt: “From the following paragraph, can you extract and list all occurrences of dates and names?</p><p id="b63e">‘On June 12, 1987, President Ronald Reagan addressed a crowd near the Brandenburg Gate in Berlin. Reagan directed his words toward Mikhail Gorbachev, who had been elected General Secretary of the Soviet Union’s Communist Party in 1985.’</p><p id="5a84"><b>Task3: Structured Output Prompt</b></p><p id="0c1f">Prompt: “Could you provide a structured step-by-step guide on troubleshooting a computer which is not starting? Include methods like checking power connection, checking monitor connection, trying a different monitor or cable, and exploring internal issues. Each step should mention the action, a brief description of how to perform that action, and what to look for after executing the step.”</p><p id="0fa1">Remember, these are only example solutions and there is a lot of variation in how these prompts can be written. The aim is to be clear and concise with your requirements while ensuring the AI understands the desired output. This balance is essentially the art of prompt engineering.</p></article></body>

Prompt Engineering 04: Understanding Writing Good Prompts (1/2)

Focusing on Writing Good Prompts(Using Delimiters to Distinguish Data, Asking for Structured Output, Including Style Information and Setting Conditions for the Model) in Prompt Engineering.

This article was produced with the help of AI, If there are mistakes, welcome to correct, I will correct in time

Photo by Jesse Echevarria on Unsplash

full lessons here👇:

1.1 Introduction to Writing Good Prompts: Explanation of the importance and roles of diverse prompting techniques. Why writing good prompts matters, and what makes a prompt “good”.

1.2 Using Delimiters to Distinguish Data: Deep dive into using delimiters like brackets or unique characters to make it easier for the AI to understand what is part of the prompt and what is data. Includes practical examples.

1.3 Asking for Structured Output: Understanding how to instruct the model to output in a structured format like JSON, XML, or HTML. Discuss strategies and techniques for obtaining structured information.

1.4 Including Style Information: Exploring how including style information in prompts can modify the output tone and make the AI responses more engaging or suited to the specific requirement.

1.5 Setting Conditions for the Model: Discuss how to set conditions in your prompts effectively for the AI model and discerning whether these conditions are met in the responses.

1.6 Review and Assessments: Review of the key concepts covered and assessments to test understanding and application of good prompting techniques in AI.

Topic: 1.1 Introduction to Writing Good Prompts

When interacting with an AI like GPT-3, the key to getting useful and relevant responses lies in the way you frame your instructions — or in other words, how you write your prompts. Prompts are powerful conduits for conveying our intents to AI; good prompts can mean the balance between a hit-or-miss response.

Why are prompts so important? The answer lies in the training of models like GPT-3. They generate text by predicting the next word in a sentence based on the current input. This is similar to how we humans might guess the ending of a sentence midway. But, unlike us humans, AIs don’t have an inherent grasp of the world — they rely solely on patterns they learned during training.

But what’s a “good” prompt? While specific requirements may vary, generally, a good prompt meets these criteria:

  • Clear Intent: The goal or request should be clear. Ambiguity may result in irrelevant or incorrect responses.
  • Specific Language: General prompts might not narrow down the response enough to be useful. Being precisely worded guides the AI better.
  • Sufficient Context: Providing enough context helps in getting more focussed responses.

Of course, writing good prompts often involves some trial and error, with tweaks and adjustments made on the go. As we progress through the curriculum, we’ll delve into more specific techniques to enhance the effectiveness of your prompts!

Topic: 1.2 Using Delimiters to Distinguish Data

AI, especially transformers like GPT-3, are not conscious beings. They learn from patterns in the data they were trained on. Sometimes, these patterns can subtly influence how the AI perceives and processes our prompts leading to some unexpected outputs.

One way to reduce the potential for misinterpretation is by clearly distinguishing the prompt’s part you want the AI to focus on from the other contextual details. This is where using delimiters can come in handy!

Delimiters are symbols or sequences of symbols used to separate items in data. They serve as markers or boundaries that signal to the AI “Hey, pay attention! This is the important part!” Think of them like the quotation marks we use when directly quoting someone’s words.

Commonly used delimiters include:

  • Quotation marks (“ ”)
  • Square brackets ([ ])
  • Parentheses (( ))
  • Curly braces ({ })

Let’s see delimiters in action!

Assume we’re asking the AI to translate a phrase to French. Compare these two prompts:

  1. “Translate the phrase I am happy to French.”
  2. “Translate the phrase [I am happy] to French.”

In the first example, it’s a bit ambiguous what the target phrase is — is “I am happy to French” the phrase to translate? It’s unclear.

In the second example, the brackets provide a clear delimiter around the target phrase, clarifying that “I am happy” is what we want to translate.

Such simple tweaks can significantly enhance the efficiency of your prompts and your interaction with AI models.

While delimiters are quite straightforward to use, here are a few essential points to keep in mind:

  1. Choice of Delimiters: Choose your delimiters based on the context of the prompt. Ideally, they should not be characters that you expect to be part of the data you’re focusing on. For example, if you expect your data to include phrases with quotations (“ “), it might be better to use a different delimiter, such as square brackets [ ].
  2. Consistent Usage: Be consistent in your use of a particular delimiter. Switching between different types of delimiters in your prompts can confuse the AI and lead to unpredictable responses.
  3. Explicit Instructions: Depending on the complexity of the task, you may want to explicitly tell the AI what your delimiters signify. For example: “Translate the following sentence, enclosed within the square brackets, into French: [I am happy]”.

Remember, the goal of using delimiters is to make our prompts as clear and unambiguous as possible for the AI. It’s about refining the AI’s understanding of what we want it to focus on, thereby steering its responses more precisely towards our desired goal.

Equipping yourself with this technique of using delimiters not only refines your capability to write effective prompts but also arms you with better control over steering the AI’s outputs.

Topic: 1.3 Asking for Structured Output

As you interact more with AI models like GPT-3, you’ll find situations where you want to obtain specific data in a structured format, be it in JSON, XML, or HTML format. Such kinds of output can be valuable for processing the data further in some applications or maintaining uniformity.

But how can you get the AI to provide this? Like we’ve learned before, it all lies in how you craft your prompt!

When asking for structured output, it’s helpful to:

  1. Make your request explicit, clearly stating the format you want.
  2. Provide a template or example if possible, showing the model what you expect.

For instance, if you want the AI to generate a weekly diet plan in JSON format, frame your prompt like this:

“Generate a weekly diet plan for a vegetarian, aged 30 with a moderately active lifestyle. The plan should be in JSON format like this:

{
    "Monday": {
        "Breakfast": "<meal>",
        "Lunch": "<meal>",
        "Dinner": "<meal>"
    },
    ...
}

Please replace <meal> with appropriate vegetarian dishes."

By being clear and explicit in your instructions, you guide the AI model to provide responses in the desired structured format.

Keep in mind that while GPT-3 is powerful, it might not get these complex prompts perfect every time. Some trial and error might be needed to further refine your prompts and get the exact output.

Remember, practice makes perfect! Keep experimenting with new ideas and see what works best for you.

Developing the ability to have AI models respond in specified, structured formats can offer numerous benefits, especially when attempting to integrate AI into an existing system. When data is structured, it can be effortlessly parsed programmatically, which provides more straightforward data manipulation and extraction.

Here are some points to consider when writing prompts for structured responses:

  • Specify the Schema: If you’re expecting a particular schema (such as JSON), spell it out in your prompt. GPT-3 doesn’t implicitly know the expected format unless it is told.
  • Offer Examples: Teaching by example is incredibly effective. The more precise the examples you provide in your prompt, the more likely GPT-3 will be able to understand and generate appropriately structured responses.

For instance, consider the below prompt:

“Please provide a description of a horse in the following JSON format:

{
    "Animal": {
        "Type": "<type>",
        "Color": "<color>",
        "Size": "<size in lbs>"
    }
}

In the case mentioned above, the AI would understand that you require the data in a specific JSON structure and respond accordingly.

Remember, don’t get discouraged if the first few prompts you write don’t work as you expect! With some practice and refinement, you’ll gain a better understanding and can tap into the powerful capabilities of AI to get highly precise and structured outputs.

Topic 1.4 Including Style Information

An impactful aspect of prompt design is the inclusion of style information, which can significantly modify the style or tone of the AI’s outputs.

Powerful AI models like GPT-3 have a broad understanding of language style and can vary their response based on the style information provided in the prompt. Whether you desire a formal tone, a casual conversation, or an old-timey Shakespearian dialogue, the model can usually adapt its output accordingly.

Including style information allows you to:

Create Engaging Content: By instructing the AI to write in a certain style, you can make the output more engaging and relatable to the intended audience. For instance, if you’re creating content for children, you might instruct the AI to ‘write in a storytelling style suitable for a 10-year-old’.

Suit Specific Requirements: There are scenarios where you need the output to follow certain stylistic guidelines (like writing a technical report or creating rhyming poetry). In such cases, specifying the style can guide the AI to generate more suitable outputs.

Control Tone: Including style information can allow you to control the general tone (humorous, serious, playful, etc.) of the generated content.

For example, look at how drastically the response changes with a slight change in style information:

Prompt: “Translate the following phrase into a Shakespearean style: ‘I’m sorry, but I can’t assist with that.’”

The AI, given its knowledge of classical English from the model it was trained on, could generate a response like: “Marry, mine assistance thou seeketh cannot be lent.”

Prompt: “Translate the following phrase into a robotic style: ‘I’m sorry, but I can’t assist with that.’”

Given that robots are typically depicted with straightforward, emotionless speech, the AI might respond with: “Apologies. Assistance protocol not found.”

Like all other aspects of prompts, mastering the use of style information might require some trial and error. But with practice, you’ll be able to harness this tool effectively to improve your interactions with AI even further.

We discussed before how including style instructions can influence the tone and format of the AI output. Now, I’ll elaborate a bit more on how we can make the most of this technique:

  • Clear and Specific Instructions: The effectiveness of your style instruction heavily relies on its clarity and specificity. The more explicit and detailed your instruction is, the more likely the AI can generate a response in your desired style.
  • Use of Examples: Providing an example can be incredibly helpful, especially when dealing with highly stylized or specialized types of writing. For instance, you might ask the AI to “Write a conclusion for an argumentative essay, similar in style to Martin Luther King Jr.’s ‘I Have a Dream’ speech.”
  • Tonal Balance Adjustment: While you can ask the AI to produce output that is humorous, sarcastic, or whimsical in nature, it’s necessary to ensure that the tonal balance you’re aiming for is suitable for your intention. Avarice, but not all topics or scenarios may suit a heavy-handed style.

In a nutshell, the usage of proper style instructions serves as a powerful tool to instruct the AI effectively. When used correctly, it can help evoke a desired emotional response from the reader, serve a specific user group, or fit a specific narrative requirement. However, it’s always important to consider the relevance of the style to your specific purpose and factor this into your prompts during the construction phase.

Topic 1.5: Setting Conditions for the Model

Setting conditions for the model in your prompts can be a useful strategy to get the output you desire. These conditions can be as explicit as asking for certain information to be included, withholding other information or specifying the format that you would like your output in.

Here are some examples:

  • Defining Output Structure: You might instruct the AI to “Write a poem about Winter in a 5–7–5 Haiku format.”
  • Limiting Information: By asking “Can you list some actors who have played the role of James Bond, but don’t include Sean Connery?”, the model is guided to omit certain information.
  • Adding Constraints: For example, “Write a story about a girl who finds a treasure map, but make it so that the story does not involve any kind of travel.”

While these are useful and can help you get more specific output, you should be aware that setting too many conditions, or ones that are hard to reconcile with each other, might pose challenges for the model to generate a suitable output.

Setting conditions for the AI can act like a filter for the response you receive. It’s a way of guiding the AI’s response, directing it to generate a more precise output that aligns with your expectations:

Positive vs. Negative Conditions: You can set both positive and negative conditions for the AI. Positive conditions inform the AI of what “to do”, while negative conditions instruct what “not to do”. For example, you might ask the AI to suggest vacation spots excluding those in Europe (a negative condition).

Complex Conditions: You can also set complex conditions combining several requirements. Be mindful, though, of not overwhelming the model with too many constraints as it might affect the fluency of the output.

Conditional Iterations: Sometimes, you might need the model to generate iterations meeting a certain condition. For example, “Generate ten unique username ideas starting with ‘Blue’ and ending with a two-digit number”.

Graphical Representations: In some cases, prompts might include conditions about graphical representation of the data. For example, “Create a pie chart to visualize the percentage distribution, but make sure no individual sector is smaller than 5%.”

While setting conditions, specificity is crucial. It’s equally important not to overdo it as that might constrain the model excessively. It’s about finding the right balance to get high-quality and precise responses from the AI.

Topic: 1.6 Review and Assessments

We’ve gone over a plethora of strategies and inputs to craft effective AI prompts — from understanding their important parts to setting conditions. Now, it’s time to put these ideas to the test:

  1. Self-Evaluation: Using the concepts we’ve studied so far, draft a few prompts for various tasks. An engaging story, a data extraction request, and a structured output request from an AI model are a few good ones to try out.
  2. Critique and Adjustment: Review your prompts — are they clear, specific, and organized? Do they effectively direct the AI model towards the results you want? If not, use your understanding of good prompt design to adjust them accordingly.
  3. Modeling Test: Present your prompts to the AI model, and assess the outputs. Do the responses align with your desired output? If not, analyze where the model went off track — was the prompt not specific enough, or were the necessary conditions not set?
  4. Iteration: Based on the model’s responses, iterate on your prompts. Refine them, adjust their specificity, add or modify delimiters, or even adjust the expected output format.

Remember, while AI prompt crafting may seem straightforward, mastering it is an iterative process. It takes practice and a profound understanding of how an AI model interprets and responds to the prompts.

Don’t worry if you don’t perfect it right off the bat. The beauty of learning lies in growth, and with time and practice, you’ll be crafting powerful and effective prompts!

let’s move forward with some examples and exercises as part of your self-assessment. This will give you a chance to apply the principles we’ve discussed throughout this curriculum.

Here are a few task prompts for you to try out:

Task1: Try to compose a prompt where you ask the AI model to generate a short story about a brave little toaster in a fantasy world full of appliances. Remember to specify the needed plot points and the ruling conditions.

Task2: Write a prompt that asks the AI model to extract specific data from a text. For example, abstract all dates and names mentioned in a selected paragraph.

Task3: Create a prompt instructing the AI model to respond with a structured output, perhaps directions for a recipe, timeline of an event, or the steps to troubleshoot a computer.

Remember, there are no outright ‘wrong’ answers, and these exercises are designed to help you understand the art of crafting effective prompts better. Take your time, remember the strategies we’ve discussed, be creative, and have fun!

Try it yourself and slide down. Below are my answers:

Task1: Short Story Prompt

Prompt: “Hello AI! Can you write a short story about a brave little toaster living in a fantastic world of appliances? The story should start with the toaster waking up to a normal day when an unexpected event shakes their world. The toaster then unites the appliances to solve a problem, showing signs of bravery and wisdom. The story ends on a positive note with toaster who learns a valuable lesson. Let your creativity reign, but remember to incorporate thrill and bits of humor in the tale.”

Task2: Data Extraction Prompt

Prompt: “From the following paragraph, can you extract and list all occurrences of dates and names?

‘On June 12, 1987, President Ronald Reagan addressed a crowd near the Brandenburg Gate in Berlin. Reagan directed his words toward Mikhail Gorbachev, who had been elected General Secretary of the Soviet Union’s Communist Party in 1985.’

Task3: Structured Output Prompt

Prompt: “Could you provide a structured step-by-step guide on troubleshooting a computer which is not starting? Include methods like checking power connection, checking monitor connection, trying a different monitor or cable, and exploring internal issues. Each step should mention the action, a brief description of how to perform that action, and what to look for after executing the step.”

Remember, these are only example solutions and there is a lot of variation in how these prompts can be written. The aim is to be clear and concise with your requirements while ensuring the AI understands the desired output. This balance is essentially the art of prompt engineering.

Prompt
Prompt Engineering
Prompt Tutorial
Learning
Self Improvement
Recommended from ReadMedium