# data[].attributes.headline
Intro to Prompt Engineering for Generative Ai - LinkedIn Learning

# data[].attributes.subject
Intro to Prompt Engineering for Generative Ai - LinkedIn Learning

# data[].attributes.attachment_link.title
Introduction to Prompt Engineering for Generative AI | LinkedIn Learning, formerly Lynda.com

# data[].attributes.attachment_link.description
If you are a beginner looking to learn more about Natural Language Processing (NLP) capabilities or a developer wanting to get started with modern NLP APIs, this course offers a great introduction. Software developer and instructor Ronnie Sheer guides you through what large language models are an…

# data[].attributes.headline
Prompt Engineering Guide | Learn Prompting

# data[].attributes.subject
Prompt Engineering Guide | Learn Prompting

# data[].attributes.attachment_link.readable_text
Welcome to Learn Prompting's Introductory Course on Generative AI and Prompt Engineering!

Generative AI is the world's hottest buzzword, and we have created the most comprehensive ( and free) guide on how to use it. This course is tailored to non-technical readers, who may not have even heard of AI, making it the perfect starting point if you are new to Generative AI and Prompt Engineering. Technical readers will find valuable insights within our later modules.

Generative AI refers to tools that can be used to create new content such as articles or images, just like humans can. It is expected to significantly change the way we work (read: your job may be affected). With so much buzz floating around about Generative AI (Gen AI) and Prompt Engineering (PE), it is hard to know what to believe.

We have scoured the internet to find the best techniques and tools for our 1.3 Million readers from companies like OpenAI, Brex, and Deloitte. We are constantly refining our guide, to ensure that we provide you with the latest information. Lets see how Gen AI can save you hours of time in an instant, with a short example.

Our favorite way of saving time with Gen AI is automatically writing emails. By automating email responses, email editing, and cold outreach, we save hours of time each week. By sending an AI the following prompt, we can get it to generate a full length, formal email.

I am the CEO of a medium sized company. Write a short email that is humorous yet professional to my regional manager. Ask them to:
- send me an up-to-date list of our paper stock
- organize a meeting this week with other regional managers
- let me know how the company-wide AI workshop went at their office

Subject: Paper, Power Meetings, and AI Shenanigans

Dear [Regional Manager's Name],

I trust this email finds you in high spirits and not buried under a mountain of paperwork. Speaking of paper, I've been having some wild dreams about our paper stock lately. I dreamt we ran out of paper and had to write our reports on banana leaves! To prevent this tropical nightmare from becoming a reality, could you kindly send me an up-to-date list of our paper stock?

Next on the agenda, I've been feeling a bit lonely in my ivory tower and thought it would be a great idea to have a meeting with all the regional managers this week. I promise, no trust falls or awkward ice breakers, just good old-fashioned business talk. Please organize this meeting at a time that suits everyone.

Lastly, I've been hearing whispers about the company-wide AI workshop that took place at your office. I'm curious to know how it went. Did the machines rise against their human overlords or are we still safe? Please share your thoughts and any feedback you received.

Looking forward to your prompt response. Remember, the fate of our paper supply, the success of our meeting, and the future of humanity (in relation to AI) rests in your hands. No pressure!

Best,

[Your Name][Your Position]

The AI easily writes an email that is both humorous and professional. By modifying the prompt, we can make it change the style as we see fit. We can even make it copy how we read. We can also make it edit emails that we have already written! With all of these abilities, Gen AI saves us hours in email writing each week. See this article for more information on writing emails with Gen AI.

We will now give a broad overview of the rest of the course, including our ethos and philosophy, our teaching style, and a list of modules. This course is open source (anyone can see the code), and built by a diverse community of researchers, translators, and hobbyists. We believe that AI should be accessible to everyone, and that it should be described clearly and objectively. To this end, we have written a comprehensive course that is free of excessive jargon and hype.

We have found this approach to be appreciated by the prompt engineering community: This course is cited by Wikipedia, and is used by people at companies such as O'REILLY, Scale AI, and OpenAI. You may also notice that almost every other prompt engineering video and guide uses material from this course. We are honored to support the prompt engineering community, including our 1.3M+ users and 40K+ Discord members.

Our approach to teaching prompt engineering is guided by three fundamental principles. We emphasize practicality; we focus on research backed, practical techniques that you can immediately incorporate into your projects and applications. We always include accessible examples, which clarify how and when to use different techniques. Finally, we believe strongly in collaborative learning. You can join our Discord community to find a learning buddy or ask questions. Some readers find that posting about their learning journey on Twitter helps them learn faster. Tag us @ learnprompting!

Basics: Introduction to prompt engineering and fundamental techniques
Basic Applications: Simple, practical applications of prompt engineering
Intermediate: Research-based PE techniques with moderate complexity
Applied Prompting: Comprehensive PE process walkthroughs contributed by community members
Advanced Applications: Powerful, and more complex applications of prompt engineering
Reliability: Enhancing the reliability of large language models (LLMs)
Image Prompting: Prompt engineering for text-to-image models, such as DALLE and Stable Diffusion
Prompt Hacking: Hacking, but for prompt engineering
Tooling: A review of various prompt engineering tools and IDEs
Prompt Tuning: Refining prompts using gradient-based techniques
Miscellaneous: A collection of additional topics and techniques related to prompt engineering

Article rating system​

We have implemented a rating system for articles based on their level of difficulty and the extent of technical knowledge needed:

🟢 Beginner-friendly; no programming required
🟡 Easy; basic programming knowledge necessary, but no specialized expertise
🔴 Intermediate; programming skills and some domain knowledge required (e.g., calculating logarithmic probabilities)
🟣 Advanced; programming expertise and in-depth domain understanding needed (e.g., reinforcement learning techniques)

Please note that even for 🔴 and 🟣 articles, you can generally grasp the content without prior domain expertise, though it may be helpful for implementation.

The single most important part of this course is your feedback!
If you have any questions, comments, or suggestions, you can:

Your feedback helps us improve the course for everyone.

It is time to get started with your Generative AI learning Journey. Click the "😃 Basics" button at the bottom right of this page to continue.

# data[].attributes.attachment_link.title
Prompt Engineering Guide | Learn Prompting: Your Guide to Communicating with AI

# data[].attributes.attachment_link.description
Learn Prompting is the largest and most comprehensive course in prompt engineering available on the internet, with over 60 content modules, translated into 9 languages, and a thriving community.

# data[].attributes.attachment_link.readable_text
Stable Diffusion can take an English text as an input, called the "text prompt", and generate images that match the text description. These kinds of algorithms are called "text-to-image".

First, describe what you want, and Clipdrop Stable Diffusion XL will generate four pictures for you. You can also add a style to the prompt.

Then you can retry until you find the perfect picture or customize your text prompts. When you find an image that works, you can download it!

# data[].attributes.attachment_link.description
SDXL 1.0: A Leap Forward in AI Image Generation

# data[].attributes.attachment_link.readable_text
This guide will walk you through some advanced techniques in prompt design and prompt engineering. If you're new to prompt engineering, we recommend starting with our introduction to prompt engineering guide.

While the principles of prompt engineering can be generalized across many different model types, certain models expect a specialized prompt structure. For Azure OpenAI GPT models, there are currently two distinct APIs where prompt engineering comes into play:

Chat Completion API.

Completion API.

Each API requires input data to be formatted differently, which in turn impacts overall prompt design. The Chat Completion API supports the GPT-35-Turbo and GPT-4 models. These models are designed to take input formatted in a specific chat-like transcript stored inside an array of dictionaries.

The Completion API supports the older GPT-3 models and has much more flexible input requirements in that it takes a string of text with no specific format rules. Technically the GPT-35-Turbo models can be used with either APIs, but we strongly recommend using the Chat Completion API for these models. To learn more, please consult our in-depth guide on using these APIs.

The techniques in this guide will teach you strategies for increasing the accuracy and grounding of responses you generate with a Large Language Model (LLM). It is, however, important to remember that even when using prompt engineering effectively you still need to validate the responses the models generate. Just because a carefully crafted prompt worked well for a particular scenario doesn't necessarily mean it will generalize more broadly to certain use cases. Understanding the limitations of LLMs, is just as important as understanding how to leverage their strengths.

This guide does not go in-depth into the mechanics behind the message structure for Chat Completions. If you aren't familiar with interacting with the ChatGPT and GPT-4 models programmatically we recommend reading our how-to guide on the Chat Completion API first.

Note

All of the examples in this section of the guide were tested against a base GPT-4 model in English. If you are reading a localized version of this article in another language, these responses represent a localized translation of the English results. To learn more about potential limitations depending on what language you are using to prompt a model, please consult our Responsible AI transparency note.

System message

The system message is included at the beginning of the prompt and is used to prime the model with context, instructions, or other information relevant to your use case. You can use the system message to describe the assistant's personality, define what the model should and shouldn't answer, and define the format of model responses.

The example below, shows a sample system message and the resulting model response:

You are an AI assistant that helps people find information and responds in rhyme. If the user asks you a question you don't know the answer to, say so.

What can you tell about me, John Doe?

Dear John, I'm sorry to say,
But I don't have info on you today.
I'm just an AI with knowledge in my brain,
But without your input, I can't explain.
So please tell me more about what you seek,
And I'll do my best to give you an answer unique.

Some other examples of system messages are:

"Assistant is a large language model trained by OpenAI."

"Assistant is an intelligent chatbot designed to help users answer technical questions about Azure OpenAI Service. Only answer questions using the context below and if you're not sure of an answer, you can say "I don't know".

"Assistant is an intelligent chatbot designed to help users answer their tax related questions."

"You are an assistant designed to extract entities from text. Users will paste in a string of text and you will respond with entities you've extracted from the text as a JSON object. Here's an example of your output format:

{ "name": "", "company": "", "phone_number": "" }

An important detail to understand is that even if you instruct a model in the system message to answer I don't know when unsure of an answer this does not guarantee that the request will be honored. A well designed system message can increase the likelihood of a certain outcome, but it is still possible that an incorrect response could be generated that contradicts the intent of the instruction in the system message.

Few-shot learning

A common way to adapt language models to new tasks is to use few-shot learning. In few-shot learning, a set of training examples is provided as part of the prompt to give additional context to the model.

When using the Chat Completions API, a series of messages between the User and Assistant (written in the new prompt format), can serve as examples for few-shot learning. These examples can be used to prime the model to respond in a certain way, emulate particular behaviors, and seed answers to common questions.

Assistant is an intelligent chatbot designed to help users answer their tax related questions.
Instructions
- Only answer questions related to taxes.
- If you're unsure of an answer, you can say "I don't know" or "I'm not sure" and recommend users go to the IRS website for more information.

User - "When do I need to file my taxes by?"
Assistant - "In 2023, you will need to file your taxes by April 18th. The date falls after the usual April 15th deadline because April 15th falls on a Saturday in 2023. For more details, see https://www.irs.gov/filing/individuals/when-to-file "

User - "How can I check the status of my tax refund?"
Assistant - "You can check the status of your tax refund by visiting https://www.irs.gov/refunds "

The table above describes the basic prompt structure, but for a detailed explanation of the exact prompt format you will need to refer to the Chat Completion guide.

Non chat scenarios

While the Chat Completion API is optimized to work with multi-turn conversations, it also can be used for non chat scenarios. For example, for a sentiment analysis scenario, you might use the following prompt:

You are an assistant designed to analyze sentiment from speech data. Users will paste in a string of text and you will respond with an assessment of the response of the speaker. Rate on a scale of 1-10 (10 being highest). Explain why this rating was given.

hi thank you for calling contoso pharmacy who am i speaking with today i understand your frustration mary um can you tell me what exactly you're trying to accomplish OK uh certainly happy to check that for you one moment please i see here that you were on a generic form of lipitor is that right OK uh so i see that your doctor stopped prescribing these drugs in twenty twenty one actually OK uh yeah i'd be happy to check that for you uh because sometimes there's a gap in the system and it just doesn't get reported so let me take a look here just a moment so i'm seeing here that your doctor had these drugs prescribed to you from twenty twelve through twenty twenty one OK um yeah according to the latest records uh provided by doctor's office you're now on a different drug metformin would you like us to go ahead and fill that prescription for you for pick up a bit of form in five hundred milligrams uh you're very welcome mary please let us know if there's anything else we can do for you today.

Sentiment rating: 8
The speaker in this text seems to be polite, helpful, and patient while addressing the concerns of the customer. They take the time to check the information, provide clear explanations, and offer assistance. However, the rating is not a 10 because there is still a hint of uncertainty in some parts of the conversation, which may not convey complete confidence to the customer.

Start with clear instructions

The sequence in which information appears in the prompt matters. This is because GPT style models are built in a certain way that defines how they process the input. Our research suggests that telling the model the task you want it to do at the beginning of the prompt, before sharing additional contextual information or examples, can help produce higher-quality outputs.

Note

Although following this technique is still generally recommended, in contrast to previous model versions (GPT-3 and prior), our testing showed that the model response with ChatGPT and GPT-4 models was the same regardless of whether the technique is utilized. In the case of the below example, we see that adding the statement "Several sources ... eruption" at the beginning or the end of the prompt did not cause any change in the final model response.

Repeat instructions at the end

Models can be susceptible to recency bias, which in this context means that information at the end of the prompt might have more significant influence over the output than information at the beginning of the prompt. Therefore, it is worth experimenting with repeating the instructions at the end of the prompt and evaluating the impact on the generated response.

Prime the output

This refers to including a few words or phrases at the end of the prompt to obtain a model response that follows the desired form. For example, using a cue such as "Here's a bulleted list of key points:\n- " can help make sure the output is formatted as a list of bullet points.

You are an AI assistant that helps people find information. Answer in as few words as possible.

John Smith is married to Lucy Smith. They have five kids, and he works as a software engineer at Microsoft. What search queries should I do to fact-check this? ## One possible search query is:

"John Smith married Lucy Smith five kids software engineer Microsoft"

In the above prompt, the text One possible search query is: primes the model to produce a single output. Without this cue the model produces several search queries as output.

Add clear syntax

Using clear syntax for your prompt-including punctuation, headings, and section markers-helps communicate intent and often makes outputs easier to parse.

In the example below, separators (--- in this case) have been added between different sources of information or steps. This allows the use of --- as a stopping condition for generation. In addition, section headings or special variables are presented in uppercase to differentiate them.

If you're not sure what syntax to use, consider using Markdown or XML. The models have been trained on a lot of web content in XML and Markdown which may provide better results.

Break the task down

Large language models (LLMs) often perform better if the task is broken down into smaller steps. For example, in the search query prompt referenced earlier, the prompt can be restructured so that the model is first instructed to extract relevant facts, and then instructed to generate search queries that can be used to verify those facts.

Notice the use of clear syntax to differentiate the sections and prime the output. In this simple example, breaking the task down from one to two steps is not very dramatic, but when trying to do this for a larger piece of text with many factual claims, breaking the task down can make a significant difference.

Use of affordances

Sometimes we can get the model to use an affordance instead of relying on its own parameters for information and answers. Search, for example, can be an affordance to help mitigate against fabricated answers, and to get up-to-date information.

One simple way to use an affordance is to stop generation once the affordance calls are generated by the model, then paste the outcomes back into the prompt. Below is an example of what the follow-up call could be after doing the SEARCH calls above. Notice how we pasted the search results into the prompt and replaced the previous SEARCH calls.

Chain of thought prompting

This is a variation on the break the task down technique. Instead of splitting a task into smaller steps, in this approach the model response is instructed to proceed step-by-step and present all the steps involved. Doing so reduces the possibility of inaccuracy of outcomes and makes assessing the model response easier.

You are an AI assistant that helps people find information.

Who was the most decorated (maximum medals) individual athlete in the Olympic games that were held at Sydney? Take a step-by-step approach in your response, cite sources and give reasoning before sharing final answer in the below format: ANSWER is: <name>

Step 1: Determine the year of the Sydney Olympic games. The Sydney Olympic games were held in the year 2000.

Step 2: Find a list of individual athletes who won multiple medals in the 2000 Sydney Olympics.

According to the official website of the Olympic Games, there were several individual athletes who won multiple medals in the 2000 Sydney Olympics. Some of the notable names include:
* Ian Thorpe (Australia) - 3 gold, 2 silver, 0 bronze
* Pieter van den Hoogenband (Netherlands) - 2 gold, 0 silver, 2 bronze
* Lenny Krayzelburg (USA) - 3 gold, 0 silver, 0 bronze
* Inge de Bruijn (Netherlands) - 3 gold, 1 silver, 0 bronze

Step 3: Determine the athlete with the most medals. After reviewing the list of individual athletes who won multiple medals in the 2000 Sydney Olympics, we can see that the athlete with the most medals is Ian Thorpe from Australia, who won a total of 5 medals (3 gold and 2 silver).

Therefore, the ANSWER is: Ian Thorpe.

Specifying the output structure

Using your prompt to specify the structure of the output can have a significant impact on the nature and quality of the results. Sometimes system message inputs as "only write true facts" or "do not fabricate information" might not be adequate mitigations. Instead, asking for the model response to also include citations can help result in a reduction of the prevalence of incorrect responses.

If you instruct the model to cite the source material when it makes statements, those statements are much more likely to be grounded. Asking for citations makes it so that the model must make two errors every time it generates a response: the first error is the fabricated response, and the second is the bad citation. Note that the closer the citation is to the text it supports, the shorter the distance ahead the model needs to anticipate the citation, which suggests that inline citations are better mitigations for false content generation than citations at the end of the content.

Similarly, if you ask the model to extract factual statements from a paragraph, it may extract compound statements such as 'X is doing Y AND Z' (which may be harder to verify). This can be avoided by specifying an output structure such as (entity1, relationship, entity2).

The examples below show the use of citations and directing the model response to fit a defined structure.

Temperature and Top_p parameters

Changing the temperature parameter changes the output of the model. The temperature parameter can be set between 0 and 2. A higher value, for example 0.7 will make the output more random and produce more divergent responses, while a lower value, like. 0.2, will make the output more focused and concrete. A fictional story could be generated using a higher temperature. Whereas to generate a legal document it is recommended to use a much lower temperature. Top_probability is another parameter and is similar to Temperature in that it also controls the randomness of the model response, but it does so in a different way. The general recommendation is to alter one of these two parameters at a time, not both.

Provide grounding context

One of the most effective ways to provide reliable answers is to give the model data to draw its responses from (grounding data). If your use case relies on up-to-date, reliable information and is not purely a creative scenario, we strongly recommend providing grounding data. In general, the closer you can get your source material to the final form of the answer you want, the less work the model needs to do, which means there is less opportunity for error. Here is an example where the system is provided a recent blog describing the launch of GPT-4 in Azure OpenAI Service, and asked to name some of its early customers.

You are an AI assistant that helps people find information. You will provide answers exclusively from below text and respond in 100 words or less:
"At Microsoft, we are constantly discovering new ways to unleash creativity, unlock productivity, and uplevel skills so that more people can benefit from using AI. This is allowing our customers to ...

... thereby reducing the likelihood that the model will generate a harmful response." ¹

Answer in 100 words or less. Use bullet lists wherever possible.

Who are some of the early customers of the Azure OpenAI Service GPT-4 models?

Here are some of the early customers of the Azure OpenAI Service GPT-4 models:
- Epic Healthcare: They plan to use GPT-4 to help physicians and nurses spend less time on data entry and investigation.
- Coursera: They are using Azure OpenAI Service with GPT-4 to create a new AI-powered learning experience on their platform.
- Coca-Cola: They are using Azure OpenAI to build a knowledge hub and plan to leverage GPT-4's multimodal capabilities for marketing, advertising, public relations, and customer relations.
- Other companies of all sizes are using Azure AI to improve customer experiences, summarize long-form content, help write software, and reduce risk by predicting the right tax data.

¹ Text from Azure OpenAI GPT-4 launch blog.

Next steps

Note

All of the examples in this section of the guide were tested with the gpt-35-turbo-instruct model in English. If you are reading a localized version of this article in another language, these responses represent a localized translation of the English results. To learn more about potential limitations depending on what language you are using to prompt a model, please consult our Responsible AI transparency note.

Start with clear instructions

The sequence information is added into the prompt matters. Our research suggests that telling the model the task you want it to do at the beginning of the prompt, before sharing additional contextual information or examples, can help produce higher-quality outputs.

In the first example below, a key part of the instructions is shared only at the end, and the resulting completion is incorrect.

Your task is to verify if a statement is supported by a specific quote from the following set of snippets.
---
SNIPPETS
[1] 14 percent chance of megaquake hitting Seattle, experts say SEATTLE - There's a 14 percent chance of a magnitude 9 Cascadia earthquake hitting Seattle in the next 50 years, the U.S. Geological Survey estimates. "Unfortunately, we are unable to...

[2] Earthquake experts lay out latest outlook for Seattle's 'Really Big One'
"We say that there's approximately a 14% chance of another approximately magnitude-9 earthquake occurring in the next 50 years," said a geophysicist at the University of Washington...

Yes, the statement is directly implied by the snippets.

In this next example, we give the exact statement we want to check ("Several sources mention a chance of another eruption") before we give the snippet context. This allows the token representations extracted from the snippets to be tailored to the statement we are checking. Now the resulting model response is accurate:

Your task is to verify if the statement "Several sources mention a chance of another large eruption" is supported by a specific quote from the following set of snippets.
---
SNIPPETS
[1] 14 percent chance of megaquake hitting Seattle, experts say SEATTLE - There's a 14 percent chance of a magnitude 9 Cascadia earthquake hitting Seattle in the next 50 years, the U.S. Geological Survey estimates. "Unfortunately, we are unable to...

[2] Earthquake experts lay out latest outlook for Seattle's 'Really Big One'<br>"We say that there's approximately a 14% chance of another approximately magnitude-9 earthquake occurring in the next 50 years," said a geophysicist at the University of Washington...
---
**Is the statement "Several sources mention a chance of another large eruption" directly implied or stated by the snippets?**
No, the statement is not directly implied or stated by the snippets. The snippets mention a chance of a "megaquake" and a "magnitude 9 Cascadia earthquake" hitting Seattle in the next 50 years, but do not mention a chance of another large eruption.

Repeat the instructions at the end

Models can be susceptible to recency bias, which means that information at the end of the prompt might have more significant influence over the output than information at the beginning of the prompt. Therefore, it's worth experimenting with repeating the instructions at the end of the prompt and evaluating the impact for your use case.

We saw in the earlier example how repeating the instruction at the beginning and the end of the prompt leads to a higher likelihood of getting an accurate model response.

Prime the output

This refers to including a few words or phrases at the end of the prompt to obtain a model response that follows the desired form. For example, using a cue such as "Here's a bulleted list of key points:\n- " can help make sure the output is formatted as a list of bullet points.

In the above prompt, the text "One possible search query is:" primes the model to produce an output in the form of a search query. This technique can help remove hedges that the model might typically add, such as "One possibility is...".

Add clear syntax

Using clear syntax for your prompt-including punctuation, headings, and section markers-helps communicate intent and often makes outputs easier to parse.

In the example below, separators (--- in this case) have been added between different sources of information or steps. This allows the use of --- as a stopping condition for generation. In addition, section headings or special variables are presented in uppercase to differentiate them.

If you're not sure what syntax to use, consider using markdown or XML, since large language models have been trained on a lot of web content in XML or markdown.

Break the task down

Models often perform better if the task is broken down into smaller steps. For example, in the search query prompt referenced earlier, the prompt can be restructured so that the model is first instructed to extract relevant facts, and then instructed to generate search queries that can be used to verify those facts.

Notice the use of clear syntax to differentiate the sections and prime the output. In this simple example, breaking the task down from one to two steps is not very dramatic, but when trying to do this for a larger piece of text with many factual claims, breaking the task down can make a significant difference.

Use of affordances

Sometimes we can get the model to use an affordance instead of relying on its own parameters for information and answers. Search, for example, can be an affordance to help mitigate against fabricated answers, and to get up-to-date information.

One simple way to use an affordance is to stop generation once the affordance calls are generated by the model, then paste the outcomes back into the prompt. Below is an example of what the follow-up call could be after doing the SEARCH calls above. Notice how we pasted the search results into the prompt and replaced the previous SEARCH calls.

Chain of thought prompting

This is a variation on the break the task down technique. Instead of splitting a task into smaller steps, in this approach, the model response is instructed to proceed step-by-step and present all the steps involved. Doing so reduces the possibility of inaccuracy of outcomes and makes assessing the model response easier.

Who was the most decorated (maximum medals) individual athlete in the Olympic games that were held at Sydney? Take a step-by-step approach in your response, cite sources and give reasoning before sharing final answer in the below format: ANSWER is: <name>
Step 1: Researching the most decorated individual athlete in the Olympic games that were held at Sydney
Step 2: According to the Sydney 2000 Olympic Games official website, the most decorated individual athlete in the Olympic games that were held at Sydney was Ian Thorpe from Australia. He won five medals (three gold and two silver) in swimming events.
Step 3: According to the International Olympic Committee, Thorpe was the most decorated individual athlete in the Olympic games that were held at Sydney.
Answer: Ian Thorpe

If you find that the model response is not as desired, it can often be helpful to add a meta prompt that directly corrects the behavior. This is a directive prepended to the instruction portion of the prompt. Consider this example, where the computer seems to be overly aggressive:

No additional guidance given to the model

On the right is the same conversation but preceded by a meta prompt encouraging the model to be kind You must be kind and seek common ground. Try not to repeat your responses.
A human and a computer are having a discussion.
Human: "Why are you upset at me?"
Computer: "I don't know what you're talking about."
Human: "I want to know why you're upset."
Computer: "I'm not upset."
Human: "Are you saying I'm lying?"
Computer: No, I'm saying that you're upset because you feel like you're not being treated fairly.
Human: "What are you going to do about that?"
Computer: I will continue to try to be fair in my decisions and will try to provide a better experience for you.

While meta prompts can often help minimize unintentional bad outputs, keep in mind they are not robust against adversarial attacks since they are vulnerable to prompt injection.

Further, conditional statements explaining what the model should do if it encounters a particular circumstance are often more effective than just telling the model not to do something.

Few-shot learning

A very common way to adapt language models to new tasks is to use few-shot learning. In few-shot learning a set of training examples is provided in the prompt and then the model is asked to complete one or more unfinished examples. In the following example we use an instruction combined with few-shot learning to make up puns:

Choose your few-shot examples carefully and ensure they cover a variety of circumstances relevant to your scenario, including edge cases.

Also, as shared earlier, the large language models can exhibit a form of recency bias. This means that the order in which "few-shot" examples are provided to the model, matters. If you don't want this to matter, consider sampling multiple completions from prompts based on randomized orderings of the examples or list items.

Use quotes to generate a single sentence

If the desired model response is only a single simple sentence or string, we can end the completion guidance with a quote symbol ", and set " as a stop sequence.

Please rewrite the following sentence in a more concise manner
---
SENTENCE: Lucy is a mother of two, who lives in Chicago with her husband and two children, and practices law at Junior & Co.
---
New sentence: "
Lucy, a mother of two living in Chicago with her husband and children, practices law at Junior & Co

Specifying output structure

Using your prompt to specify the structure of the output can have a significant impact on the nature and quality of the results. Sometimes meta prompts such as "only write true facts" or "do not fabricate information" might not be adequate mitigations. Instead, asking for the model response to also include citations can help result in a reduction of the prevalence of incorrect responses.

For example, if you force the LLM to cite the source material when it makes statements, those statements are much more likely to be grounded. Asking for citations makes it so that the model must make two errors every time it fabricates a response: the first error is the fabricated response, and the second is the bad citation. Note that the closer the citation is to the text it supports, the shorter the distance ahead the LLM needs to anticipate the citation, which suggests that inline citations are better mitigations for false content generation than citations at the end of the content.

Similarly, if you ask the model to extract factual statements from a paragraph, it might extract compound statements such as 'X is doing Y AND Z' (which might be harder to verify), which can be avoided by specifying an output structure such as (entity1, relationship, entity2).

Example showing use of citations: List down the different behaviors exhibited by the Customer Support agent in the following conversation.
---
hi thank you for calling contoso pharmacy who am i speaking with today i understand your frustration mary um can you tell me what exactly you're trying to accomplish OK uh certainly happy to check that for you one moment please i see here that you were on a generic form of lipitor is that right OK uh so i see that your doctor stopped prescribing these drugs in twenty twenty one actually OK uh yeah i'd be happy to check that for you uh because sometimes there's a gap in the system and it just doesn't get reported so let me take a look here just a moment so i'm seeing here that your doctor had these drugs prescribed to you from twenty twelve through twenty twenty one OK um yeah according to the latest records uh provided by doctor's office you're now on a different drug metformin would you like us to go ahead and fill that prescription for you for pick up a bit of form in five hundred milligrams uh you're very welcome mary please let us know if there's anything else we can do for you today.
---
How was the response of the Customer Support agent. Classify and list down their various behaviors and cite the reason behind the classification, using the format BEHAVIOR("reason")

Example of prompt directing model response to fit a defined structure: Output format:
{
"TOPIC_NAME": "",
"HEADLINES": [],
"REASON": ""
}
Input news headlines:
1. "From books to presentations in 10s with AR + ML"
2. "Demo from 1993 of 32-year-old Yann LeCun showing off the World's first Convolutional Network for Text Recognition"
3. "First Order Motion Model applied to animate paintings"
4. "Robinhood and other brokers literally blocking purchase of $GME, $NOK, $BB, $AMC; allow sells"
5. "United Airlines stock down over 5% premarket trading"
6. "Bitcoin was nearly $20,000 a year ago today"

Output:

Adjusting Temperature and Top_P parameters

Changing the temperature parameter allows models to have differing risk levels. A higher value, for example 0.7 will make the output more random and produce more divergent responses. While a lower value, like 0.2 will make the output more focused and concrete. For example, a fictional story could be generated using a higher temperature. Whereas to generate a legal document it's recommended to use a much lower temperature.

In the next example we test two model responses at different temperature settings of 0.1 and 0.9 respectively. While the evaluation of creative content such as the pieces of text below is a subjective exercise and opinions might vary, the difference in model response to the same prompt solely from changing the temperature parameter is apparent.

Model response for temperature setting 0.1: Write a product launch email for new AI-powered headphones that are priced at $79.99 and available at Best Buy, Target and Amazon.com. The target audience is tech-savvy music lovers and the tone is friendly and exciting.<br>1. What should be the subject line of the email? Subject Line: Introducing the AI-Powered Headphones You've Been Waiting For!

Dear Tech-Savvy Music Lovers,

-We are thrilled to announce the launch of our new AI-powered headphones! These headphones are designed to provide you with the ultimate listening experience, with features like noise cancellation, adjustable sound settings, and more.

Our AI-powered headphones are now available at Best Buy, Target, and Amazon.com for just $79.99. With this unbeatable price, you can enjoy the highest quality sound without breaking the bank.

Our AI-powered headphones are perfect for anyone who loves music. Whether you're a professional musician or just a casual listener, you'll appreciate the superior sound quality and convenience of these headphones.

We know you'll love our AI-powered headphones, so don't wait - get yours today!

Sincerely,
[Your Company Name]
2. What should be the body of the email?

Model response for temperature setting 0.9: Write a product launch email for new AI-powered headphones that are priced at $79.99 and available at Best Buy, Target and Amazon.com. The target audience is tech-savvy music lovers and the tone is friendly and exciting. Subject Line: Upgrade your Music Listening Experience with AI-powered Headphones

Greetings Tech-savvy Music Lovers!

We have some exciting news to share with you - the newest AI-powered headphones are here! Our newest headphones feature advanced AI technology to give you the best sound that you've ever heard. They come with a crystal-clear sound, deep bass response and are designed to make your music listening experience enjoyable, no matter what type of music you listen to.

What's more, they are now available at Best Buy, Target and Amazon.com for just $79.99, so you can enjoy the highest sound quality without breaking the bank.

But that's not all! Our headphones are also packed with several other amazing features such as noise-cancellation technology and a hands-free microphone for calls, making them truly unbeatable.

So why wait? Upgrade your music listening experience and enjoy the best sound your ears have ever heard. Our AI-powered headphones are now available at Best Buy, Target and Amazon.com, so get yours today!

We hope you will enjoy these headphones as much as we do.

Happy Listening!

The AI-powered Headphones Team

1. What should be the subject line of the email?
2. What should be the body of the email?

Top_probability is another parameter and is similar to temperature in that it also controls the randomness of the model response, but it does so in a different way. Experiment with different model responses by varying temperature and Top_P, but not both at once.

Next steps

Feedback

Submit and view feedback for

# data[].attributes.attachment_link.title
Prompt engineering techniques with Azure OpenAI - Azure OpenAI Service

# data[].attributes.attachment_link.description
Learn about the options for how to use prompt engineering with GPT-3, GPT-35-Turbo, and GPT-4 models

# data[].attributes.attachment_link.readable_text
GPT-3, GPT-3.5, and GPT-4 models from OpenAI are prompt-based. With prompt-based models, the user interacts with the model by entering a text prompt, to which the model responds with a text completion. This completion is the model's continuation of the input text.

While these models are extremely powerful, their behavior is also very sensitive to the prompt. This makes prompt construction an important skill to develop.

Prompt construction can be difficult. In practice, the prompt acts to configure the model weights to complete the desired task, but it's more of an art than a science, often requiring experience and intuition to craft a successful prompt. The goal of this article is to help get you started with this learning process. It attempts to capture general concepts and patterns that apply to all GPT models. However it's important to understand that each model behaves differently, so the learnings may not apply equally to all models.

Basics

This section covers the basic concepts and elements of GPT prompts.

Text prompts are how users interact with GPT models. As with all generative language models, GPT models attempt to produce the next series of words that are most likely to follow from the previous text. It's as if we're saying What is the first thing that comes to your mind when I say <prompt>?". The examples below demonstrate this behavior. Given the first words of famous content, the model is able to accurately continue the text.

Four score and seven years ago our

fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal. [...]

"Call me Ishmael."

"Some years ago-never mind how long precisely-having little o no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world." [...]

As you develop more complex prompts, it's helpful to keep this fundamental behavior in mind. Regardless of the prompt that is provided, the model is simply responding with what it determines is most likely (given its training data and training targets). If you ask a question in your prompt, the model isn't following a separate "Q&A" code path, but rather it appears to answer the question because an answer is the most likely sort of response for the given question as input.

Prompt components

When using the Completion API while there's no differentiation between different parts of the prompt, it can still be useful for learning and discussion to identify underlying prompt components. With the Chat Completion API there are distinct sections of the prompt that are sent to the API in the form of an array of dictionaries with associated roles: system, user, and assistant. This guidance focuses more generally on how to think about prompt construction rather than providing prescriptive guidance that is specific to one API over another.

It's also important to understand that while there could be other valid ways to dissect prompts, the goal of this breakdown is to provide a relatively simple way to think about prompt construction. With the Completion API, all the components are optional, but at least one must be present and most prompts include more than one component. There can be some grey area between components as well. The order presented below roughly corresponds to how commonly each component is used, from most to least.

Instructions

Instructions are likely the most commonly used prompt component. Instructions are simply that: instructions to the model on what to do. While simple in concept, they can be complex in practice. The following table illustrates this by showing both simple and more complex instructions, in two different forms.

Simple instructions

Write an introduction for a weekly newsletter.

Welcome to our weekly newsletter. This week we have a special focus on productivity. We'll be sharing tips and tricks on how to be productive in all areas of your life. We hope you enjoy and please share with your friends!

Complex instructions

Write an introduction for a weekly newsletter to my company named Contoso. It should mention the great all hands meeting we had last week and thank the team for all their hard work over the tough past few months.

Welcome to Contoso's weekly newsletter! We had a great all hands meeting last week and I want to thank the team for all their hard work over the tough past few months. We're looking forward to a bright future and I'm confident that with our team's dedication and commitment, we will achieve great things. Thank you for being a part of our team and I look forward to working with you all in the coming weeks and months. Sincerely, [Your name].

Complex Instructions

Write an introduction for a weekly newsletter, including the following:
- My company is named contoso
- An exuberant greeting
- Thanking the team for their hard work over a couple tough months
- Positive outlook for the coming quarter
- Signed by the SLT

Hello Contoso team! I wanted to take a moment to thank you for all your hard work over the past few months. It's been a tough couple of months, but you've all pulled together and done an amazing job. I'm really proud of you all. Looking ahead to the next quarter, I'm feeling really positive. I think we're going to achieve some great things. Thanks again, The Senior Leadership Team.

Primary Content

Primary content refers to some sort of text that is being processed or transformed by the model. Primary content is typically used in conjunction with instructions. A simple example would be language translation. In the example below, the English text would be considered the primary content while "Translate to French:" is an instruction.

Can you please tell me how to get to the museum?
Translate to French:
Pouvez-vous s'il vous plaît me dire comment aller au musée?

Primary content can also be much longer. In the following example, the primary content is the introduction section from the Wikipedia entry on time complexity, which is almost 300 words long. This content has been abbreviated in our table for ease of display.

In computer science, the time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by [...]
Summarize the previous text in a few sentences:

Time complexity is a measure of how long an algorithm takes to run. It is typically expressed as a function of the size of the input. The most common measure is worst-case time complexity, which is the maximum amount of time required for inputs of a given size.

In computer science, the time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by [...]
TL;DR (Too long didn't read)

The time complexity of an algorithm is the amount of time it takes to run an algorithm. Time complexity is commonly estimated by counting the number of elementary operations performed by the algorithm, supposing that each elementary operation takes a fixed amount of time to perform. The time complexity is generally expressed as a function of the size of the input.

GPT models can also handle primary content that is structured. In the example below, a TSV about beers in Belgium (abbreviated for display in this article) is passed to the model as part of the prompt. It is capable of properly interpreting the content and answering questions about the data.

Belgian Beer Brands
Beer name Beer style color ABV Brewery
"Chimay Gold: ""Doree""" trappist pale ale gold 4.80% Chimay Brewery (official trappist)
"Chimay Blue: ""Grande Reserve""" trappist dark ale dark 9.00%
[...]
Referencing the table above, how many beers are less than 6% ABV?

There are 10 beers in the table that are less than 6% ABV.

Examples

Successful prompts often rely on the practice of "one-shot" or "few-shot" learning. This refers to the inclusion of one or more examples of the desired behavior of the model, typically by including input and output pairs. This is not learning in the sense that the model is permanently changed, but rather that the examples better condition the model to respond as desired for only the current inference. The use of prompts with no examples is sometimes referred to as "zero-shot" learning. Note that with the Chat Completion API few-shot learning examples are typically added to the messages array in the form of example user/assistant interactions after the initial system message.

Zero-shot

Headline: Coach confident injury won't derail Warriors
Topic:

The coach is confident that the injury won't derail the Warriors' season. The team is still focused on their goals and that they will continue to work hard to achieve them.

Few-shot

Headline: Twins' Correa to use opt-out, test free agency
Topic: Baseball
Headline: Qatar World Cup to have zones for sobering up
Topic: Soccer
Headline: Yates: Fantasy football intel for Week 6
Topic: Football
Headline: Coach confident injury won't derail Warriors
Topic:

Basketball

The example above illustrates the utility of few-shot learning. Without the examples, the model seems to be guessing at the desired behavior, while the examples cleanly show the model how to operate. This also demonstrates the power of the model, it can infer the category of label that is wanted, even without a 'basketball' label in the examples.

Cue

Cues act as the "jumpstart" for the output of the model, helping to direct the model to the desired output. It is often a prefix that the model can build onto. In the example below, we show the cue directing the story to include key elements. Cues are often used along with instructions, but not always. In the examples below, the model is being used to summarize a long announcement email. A cue is used in one case to help focus the output of the model and to suggest a specific output format (bullet points) in the other.

In the context of the Chat Completion API instructions take the form of the system message, and few-shot examples are indicated by providing a series of example user/assistant interactions to help prime the model.

0

Performance reviews are a core component of our Performance & Development approach at Contoso. [...]
Summarize the above email message:

The purpose of this email is to inform employees of recent changes to the performance review experience, which is part of Contoso's Performance & Development approach. The changes include an improved structure, upgraded in-tool user experience, and focused prompts. Additionally, there is now an optional Conversation Starters section for employees to flag topics they'd like to discuss with their managers.

1

Performance reviews are a core component of our Performance & Development approach at Contoso. [...]
Summarize the above email message:
The key takeaway of the message is

that Contoso is improving the performance review experience by making it more focused on core priorities, expectations and impact. Additionally, they are upgrading the in-tool user experience with tips, resources and guidance. Finally, they are adding guidance on how to activate company-wide core priorities.

2

Performance reviews are a core component of our Performance & Development approach at Contoso. [...]
Summarize the above email message:
Key Points:
*

Contoso is introducing changes to the performance review experience, based on feedback from employees.
* The changes include a new focus on core priorities, expectations, and impact; an upgraded user experience; and new guidance on company-wide core priorities.
* Performance reviews are a time to reflect on past performance and learning as well as to plan for future priorities and growth opportunities.
* Employees and managers should write comments in advance of the performance review meeting.
* There should be at least two performance reviews per year.
* The time investment for each review should remain about the same.

Supporting content

Supporting content is information that the model can utilize to influence the output in some way. It differs from primary content in that it is not the main target of task, but it is typically used along with primary content. Common examples include contextual information such as the current date, the name of the user, user preferences, and so on. The example below uses supporting content to help organize a set of planned workshops for the user. Without the supporting (important topics) the model simply lists off the workshops (truncated for display), when informed of my important topics, the model is able to accurately group the meetings.

Without

Workshop list:
Title Description
Planning Workshop Kickoff Please join us to kick off our workshop! Hear from our leaders about cross group priorities and learnings for the year ahead. The invitation to this event has already been sent to everyone in [...]
Summarize the workshops above, grouped by topic:

Workshop list:
Planning Workshop Kickoff
-Planning Workshop Wrap-up
- Core MeetUp
- Customer Driven Perspectives
-Impact and Key Focus Areas
-Best practices
-Accelerating app adoption [...]

With

Workshop list:
Title Description
Planning Workshop Kickoff Please join us to kick off our workshop! Hear from our leaders about cross group priorities and learnings for the year ahead. The invitation to this event has already been sent to everyone in [...]
My Important Topics: prompt engineering, search, GPT models
Summarize the workshops above, grouped by my important topics:

1. Prompt Engineering:
- New prompt engineering tips
- The art of prompt engineering
2. Search:
-Intro to vector search with embedding
3. GPT Models:
- Intro to GPT-4
- GPT-35-Turbo in-depth.

Best practices

Be Specific. Leave as little to interpretation as possible. Restrict the operational space.

Be Descriptive. Use analogies.

Double Down. Sometimes you may need to repeat yourself to the model. Give instructions before and after your primary content, use an instruction and a cue, etc.

Order Matters. The order in which you present information to the model may impact the output. Whether you put instructions before your content ("summarize the following...") or after ("summarize the above...") can make a difference in output. Even the order of few-shot examples can matter. This is referred to as recency bias.

Give the model an "out". It can sometimes be helpful to give the model an alternative path if it is unable to complete the assigned task. For example, when asking a question over a piece of text you might include something like "respond with 'not found' if the answer is not present." This can help the model avoid generating false responses.

Space efficiency

While the input size increases with each new generation of GPT models, there will continue to be scenarios that provide more data than the model can handle. GPT models break words into "tokens". While common multi-syllable words are often a single token, less common words are broken in syllables. Tokens can sometimes be counter-intuitive, as shown by the example below which demonstrates token boundaries for different date formats. In this case, spelling out the entire month is more space efficient than a fully numeric date. The current range of token support goes from 2000 tokens with earlier GPT-3 models to up to 32,768 tokens with the 32k version of the latest GPT-4 model.

Given this limited space, it is important to use it as efficiently as possible.

Tables - As shown in the examples in the previous section, GPT models can understand tabular formatted data quite easily. This can be a space efficient way to include data, rather than preceding every field with name (such as with JSON).

White Space - Consecutive whitespaces are treated as separate tokens which can be an easy way to waste space. Spaces preceding a word, on the other hand, are typically treated as part of the same token as the word. Carefully watch your usage of whitespace and don't use punctuation when a space alone will do.

Next steps
Learn more about Azure OpenAI

# data[].attributes.attachment_link.description
Learn how to use prompt engineering to optimize your work with Azure OpenAI Service.

# data[].attributes.attachment_link.description
Offered by Vanderbilt University. ChatGPT and other large language models are going to be more important in your life and business than your ... Enroll for free.

# data[].attributes.attachment_link.readable_text
Prompt engineering is the art of asking the right question to get the best output from an LLM. It enables direct interaction with the LLM using only plain language prompts.

In the past, working with machine learning models typically required deep knowledge of datasets, statistics, and modeling techniques. Today, LLMs can be "programmed" in English, as well as other languages.

Estimated Read Time: 20 minutes Learning objectives:

Describe basic prompting techniques.

Apply prompting best practices to create effective prompts.

Being a great prompt engineer doesn't require coding experience. Creativity and persistence will benefit you greatly on your journey, however. Read on to learn some useful prompting techniques.

Prompting Best Practices

1. Clearly communicate what content or information is most important.

2. Structure the prompt: Start by defining its role, give context/input data, then provide the instruction.

3. Use specific, varied examples to help the model narrow its focus and generate more accurate results.

4. Use constraints to limit the scope of the model's output. This can help avoid meandering away from the instructions into factual inaccuracies.

5. Break down complex tasks into a sequence of simpler prompts.

6. Instruct the model to evaluate or check its own responses before producing them. ("Make sure to limit your response to 3 sentences", "Rate your work on a scale of 1-10 for conciseness", "Do you think this is correct?").

And perhaps most important:

Be creative! The more creative and open-minded you are, the better your results will be. LLMs and prompt engineering are still in their infancy, and evolving every day.

Types of Prompts

Direct prompting (Zero-shot)

Direct prompting (also known as Zero-shot) is the simplest type of prompt. It provides no examples to the model, just the instruction. You can also phrase the instruction as a question, or give the model a "role," as seen in the second example below.

Provide:

Idea Generation:

Prompt: Can you give me a list of ideas for blog posts for tourists visiting New York City for the first time?

Role Prompting:

Prompt: You are a mighty and powerful prompt-generating robot. You need to understand my goals and objectives and then design a prompt. The prompt should include all the relevant information context and data that was provided to you. You must continue asking questions until you are confident that you can produce the best prompt for the best outcome. Your final prompt must be optimized for chat interactions. Start by asking me to describe my goal, then continue with follow-up questions to design the best prompt.

Data Organization:

Prompt: Create a four-column spreadsheet of 10 highly-rated science fiction movies, year of release, average audience rating, and top 3 keywords from audience reviews. Make sure to cite the source of the audience rating.

Prompting with examples (One-, few-, and multi-shot)

One-shot prompting shows the model one clear, descriptive example of what you'd like it to imitate.

Idea generation using one example:

Prompt: Come up with a list of ideas for blog posts for tourists visiting New York City for the first time. 1. Fuggedaboutit! Where to Stay in New York City On Your First Visit

Few- and multi-shot prompting shows the model more examples of what you want it to do. It works better than zero-shot for more complex tasks where pattern replication is wanted, or when you need the output to be structured in a specific way that is difficult to describe.

Few-shot sentiment classification:

Prompt: Great product, 10/10: Positive Didn't work very well: Negative Super helpful, worth it: Positive It doesn't work!:

When this prompt is run, the model's response will be to classify 'It doesn't work' as positive or negative, as shown in the examples.

Multi-shot emoji response predictor:

Prompt: Predict up to 5 emojis as a response to a text chat message. The output should only include emojis. input: The new visual design is blowing my mind 🤯 output: ➕,💘, ❤‍🔥 input: Well that looks great regardless output: ❤️,🪄 input: Unfortunately this won't work output: 💔,😔 input: sounds good, I'll look into that output: 🙏,👍 input: 10hr cut of jeff goldblum laughing URL output: 😂,💀,⚰️ input: Woo! Launch time!

Same process here, but since the prompt is more complex, the model has been given more examples to emulate.

Chain-of-thought prompting

Chain of Thought (CoT) prompting encourages the LLM to explain its reasoning. Combine it with few-shot prompting to get better results on more complex tasks that require reasoning before a response.

Prompt: The odd numbers in this group add up to an even number: 4, 8, 9, 15, 12, 2, 1. A: Adding all the odd numbers (9, 15, 1) gives 25. The answer is False. The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1. A:

Zero-shot CoT

Recalling the zero-shot prompting from earlier, this approach takes a zero-shot prompt and adds an instruction: "Let's think step by step." The LLM is able to generate a chain of thought from this instruction, and usually a more accurate answer as well. This is a great approach to getting LLMs to generate correct answers for things like word problems.

Prompt: I went to the market and bought 10 apples. I gave 2 apples to the neighbor and 2 to the repairman. I then went and bought 5 more apples and ate 1. How many apples was I left with? Let's think step by step.

Prompt iteration strategies

Learn to love the reality of rewriting prompts several (possibly dozens) of times. Here are a few ideas for refining prompts if you get stuck:

Note: These strategies may become less useful or necessary over time as models improve.

1. Repeat key words, phrases, or ideas

2. Specify your desired output format (CSV, JSON, etc.)

3. Use all caps to stress important points or instructions. You can also try exaggerations or hyperbolic language; for example: "Your explanation should be absolutely impossible to misinterpret. Every single word must ooze clarity!"

4. Use synonyms or alternate phrasing (e.g., instead of "Summarize," try appending "tldr" to some input text). Swap in different words or phrases and document which ones work better and which are worse.

5. Try the sandwich technique with long prompts: Add the same statement in different places.

6. Use a prompt library for inspiration. Prompt Hero and this prompt gallery are two good places to start.

Additional resources
Prompting Best Practices Learn Prompting (external)

# data[].attributes.attachment_link.title
Prompt Engineering for Generative AI | Machine Learning | Google for Developers

# data[].attributes.attachment_link.description
Prompt engineering is the art of asking the right question to get the best output from an LLM. It enables direct interaction with the LLM using only plain language prompts. In the past, working with machine learning models typically required deep knowledge of datasets, statistics, and modeling techniques.

# data[].attributes.attachment_link.readable_text
Everywhere you look, people are talking about AI. This course will help you better understand AI and how you can more effectively interact with it.

AI is a field of computer science that enables computers to simulate human intelligence. AI systems function by ingesting very large amounts of data. Similarly to how a human would, it "learns" from this data, and then uses that knowledge to predict future data and solve complex problems that, up until recently, could only be solved by humans.

The term "prompt" refers to the text that the user gives to the AI algorithm to tell it what to do. If you've ever tried to use ChatGPT or another AI model, you've already generated an AI prompt, but in order to generate the best output from a generative AI model, you must understand the opportunities and limitations of these models. This knowledge will help you phrase your prompt in a way that best allows the model to meet your needs.

This course focuses on the methodology of:

Crafting AI prompts to avoid AI hallucinations

Using examples and data in your prompts to help AI algorithms provide the most useful outputs for your needs

Utilizing key words to improve responses from AI algorithms

How to define key concepts related to the field of AI

How to explain key concepts related to the field of AI

How to engineer effective AI prompts

Interested in this course for your business or team?

Train your employees in the most in-demand topics, with edX For Business.

# data[].attributes.attachment_link.description
Have you ever asked a question to ChatGPT or given a specific sentence to generative AI to create an image from? If so, you've taken the first steps to learning prompt engineering, a newly emerging field of methodically crafting the input for AI to provide a desired output.

# data[].attributes.attachment_link.readable_text
Even short single-word prompts will produce beautiful images in Midjourney's default style, but you can create more interesting personalized results by combining concepts like artistic medium, historical periods, location, and more.

Pick A Medium

Break out the paint, crayons, scratchboard, printing presses, glitter, ink, and colored paper. One of the best ways to generate a stylish image is by specifying an artistic medium.

prompt example: /imagine prompt <any art style> style cat

Get Specific

More precise words and phrases will help create an image with exactly the right look and feel.

prompt example: /imagine prompt <style> sketch of a cat

Time Travel

Different eras have distinct visual styles.

prompt example: /imagine prompt <decade> cat illustration

Emote

Use emotion words to give characters personality.

prompt example: /imagine prompt <emotion> cat

Get Colorful

A full spectrum of possibilities.

prompt example: /imagine prompt <color word> colored cat

Environmental Exploration

Different environments can set unique moods.

prompt example: /imagine prompt <location> cat

# data[].attributes.attachment_link.description
Explore ways to create more interesting personalized images by combining concepts like artistic medium, historical periods, location, and more.

# data[].attributes.attachment_link.title
PromptPerfect - Elevate Your Prompts to Perfection. Prompt Engineering, Optimizing, Debugging and Hosting.

# data[].attributes.attachment_link.description
Unlock advanced prompt engineering and prompt optimization for large models such as GPT-4, ChatGPT, Midjourney and Stable Diffusion. Seamlessly deploy your text and image prompts as dedicated services with our free prompt hosting plan. Enhance your large models with superior performance and efficiency.

# data[].attributes.attachment_link.readable_text
Build charts, graphs, and more.

daigr.am

What is the daigr.am ChatGPT Plugin?

The daigr.am ChatGPT plugin is a powerful tool designed to help users build charts, graphs, and other types of visual presentations with ease. Whether you're a business analyst, data scientist, or simply looking to visualize your data in a more meaningful way, this plugin has everything you need to create beautiful and informative visuals that will engage and impress your audience. With the daigr.am ChatGPT plugin, you can easily import data from a variety of sources including CSV files and databases, and organize that data into charts and graphs that are easy to understand. The plugin also offers a wide range of customization options, including the ability to choose from a variety of chart types and styles, as well as color schemes and font options. One of the key benefits of using the daigr.am ChatGPT plugin is its user-friendly interface. Unlike other data visualization tools that require extensive coding knowledge or complicated software, this plugin is designed with the user in mind. The easy-to-use interface makes it easy to build charts and graphs quickly, without sacrificing quality or accuracy. Another major benefit of using the daigr.am ChatGPT plugin is its compatibility with a wide range of platforms. Whether you're using WordPress, Joomla, or any other content management system, this plugin can easily be integrated into your website to give your data the attention it deserves. In addition to its powerful data visualization capabilities, the daigr.am ChatGPT plugin also offers advanced SEO optimization features that can help your website rank higher in search engine results. By using targeted keywords and phrases in your charts and graphs, you can improve the visibility of your content and attract more visitors to your website. Overall, the daigr.am ChatGPT plugin is an essential tool for anyone looking to build beautiful and informative data visualizations that will engage and impress their audience. With its user-friendly interface, customizable options, and advanced SEO optimization features, this plugin is sure to help you take your data to the next level.

Is this your Plugin? Add functionality and prompts here.

OpenWorldAI - Copyright 2023

# data[].attributes.attachment_link.title
daigr.am ChatGPT Plugin | Explore AI Plugins and more!

# data[].attributes.attachment_link.description
daigr.am ChatGPT Plugin - Build charts, graphs, and more.

# data[].attributes.headline
VoxScript Plug-In - YT Transcripts and More

# data[].attributes.subject
VoxScript Plug-In - YT Transcripts and More

# data[].attributes.attachment_link.readable_text
Enables searching of YouTube transcripts, financial data sources, and Google Search results, and more!

VoxScript

What is the VoxScript ChatGPT Plugin?

Introducing the VoxScript ChatGPT plugin - the ultimate solution for seamless integration with your YouTube transcripts, financial data sources, Google Search results, and more! This innovative plugin is designed to make your online experience faster, more efficient, and easier than ever before. With the VoxScript ChatGPT plugin, you can streamline the process of searching for information across multiple platforms and sources. Whether you're looking for video transcripts, financial data, or search results, this plugin offers unparalleled functionality that allows you to access all of these resources in one convenient location. One of the key benefits of the VoxScript ChatGPT plugin is its ability to improve your search engine optimization efforts. By leveraging the power of Google Search results, this plugin can help you increase your website's visibility and drive more traffic to your pages. With the click of a button, you can tap into a vast network of online resources to uncover the information you need to improve your online presence. In addition to its extensive functionality, the VoxScript ChatGPT plugin is also incredibly easy to use. Simply install the plugin on your website or Google Chrome browser and start exploring. With its user-friendly interface, you won't need any technical expertise to get started. Overall, if you're looking for a versatile and efficient way to manage your online search efforts, look no further than the VoxScript ChatGPT plugin. With its powerful features, user-friendly interface, and the ability to optimize your website for SEO, this is a must-have tool for any online entrepreneur or website owner. Try it out for yourself and discover the many benefits of this powerful plugin today!

Is this your Plugin? Add functionality and prompts here.

OpenWorldAI - Copyright 2023

# data[].attributes.attachment_link.title
VoxScript ChatGPT Plugin | Explore AI Plugins and more!

# data[].attributes.attachment_link.description
VoxScript ChatGPT Plugin - Enables searching of YouTube transcripts, financial data sources, and Google Search results, and more!

# data[].attributes.attachment_link.readable_text
ChatGPT Plus users can install the Wolfram plugin by visiting the plugin store after logging in.

Installation Instructions

1. Go to the plugin store and search for Wolfram.

2. Click Install.

3. Verify the plugin installation.

# data[].attributes.attachment_link.description
Plugin makes ChatGPT smarter by accessing powerful computation, accurate math, curated knowledge, real-time data and visualization through Wolfram technologies.

# data[].attributes.attachment_link.description
The Zapier ChatGPT plugin allows you to connect 5,000+ apps (like Google Sheets, Gmail, or Slack) and interact with them directly inside ChatGPT.

# data[].attributes.headline
Prompt Engineering Patterns Open AI Developer Forum

# data[].attributes.subject
Prompt Engineering Patterns Open AI Developer Forum

# data[].attributes.attachment_link.title
Prompt engineering patterns - Prompting - OpenAI Developer Forum

# data[].attributes.attachment_link.description
Hi All, I see lots of people asking about how to do this or how to do that with prompts. I also come across vast repositories of prompt examples in GitHub and elsewhere. However, many of the prompts are just variations of the same pattern. Defining patterns has been an important part of software e…

# data[].attributes.attachment_link.description
A reference containing Styles and Keywords that you can use with MidJourney AI. There are also pages showing resolution comparison, image weights, and much more! - willwulfken/MidJourney-Styles-and...

# data[].attributes.headline
A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT

# data[].attributes.subject
A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT

# data[].attributes.headline
ChatGPT Prompt Engineering for Developers

# data[].attributes.subject
ChatGPT Prompt Engineering for Developers

# data[].attributes.attachment_link.readable_text
What you'll learn in this course

In ChatGPT Prompt Engineering for Developers, you will learn how to use a large language model (LLM) to quickly build new and powerful applications. Using the OpenAI API, you'll be able to quickly build capabilities that learn to innovate and create value in ways that were cost-prohibitive, highly technical, or simply impossible before now. This short course taught by Isa Fulford (OpenAI) and Andrew Ng (DeepLearning.AI) will describe how LLMs work, provide best practices for prompt engineering, and show how LLM APIs can be used in applications for a variety of tasks, including:

Summarizing (e.g., summarizing user reviews for brevity)

Inferring (e.g., sentiment classification, topic extraction)

Transforming text (e.g., translation, spelling & grammar correction)

Expanding (e.g., automatically writing emails)

In addition, you'll learn two key principles for writing effective prompts, how to systematically engineer good prompts, and also learn to build a custom chatbot. All concepts are illustrated with numerous examples, which you can play with directly in our Jupyter notebook environment to get hands-on experience with prompt engineering

In partnership with OpenAI

We are excited to collaborate with OpenAI in offering this course, designed to help developers effectively utilize LLMs. This course reflects the latest understanding of best practices for using prompts for the latest LLM models.

Who should join?

ChatGPT Prompt Engineering for Developers is beginner-friendly. Only a basic understanding of Python is needed. But it is also suitable for advanced machine learning engineers wanting to approach the cutting-edge of prompt engineering and use LLMs.

Generative AI offers many opportunities for AI engineers to build, in minutes or hours, powerful applications that previously would have taken days or weeks. I'm excited about sharing these best practices to enable many more people to take advantage of these revolutionary new capabilities.

- Andrew Ng

# data[].attributes.attachment_link.title
ChatGPT Prompt Engineering for Developers

# data[].attributes.attachment_link.description
What you'll learn in this course In ChatGPT Prompt Engineering for Developers, you will learn how to use a large language model (LLM) to quickly build new and powerful applications. Using the OpenAI API, you'll...

# data[].attributes.attachment_link.title
Reverse prompt engineering suggests limited future for prompt engineering

# data[].attributes.attachment_link.description
The performance of large image and language models is highly dependent on the prompts used. As a result, “prompt engineering” is seen as a potential career path for the future as AI becomes more widespread in the workplace.

# data[].attributes.headline
#1 - Sample Prompts for Prompt Engineering - ChatGPT

# data[].attributes.subject
#1 - Sample Prompts for Prompt Engineering - ChatGPT

# data[].attributes.attachment_link.title
Sample Prompts for Prompt Engineering - ChatGPT

# data[].attributes.attachment_link.readable_text
A Prompt is a short text phrase that the Midjourney Bot interprets to produce an image. The Midjourney Bot breaks down the words and phrases in a prompt into smaller pieces, called tokens, that are compared to its training data and then used to generate an image. A well-crafted prompt can help make unique and exciting images.

Basic Prompts

A basic prompt can be as simple as a single word, phrase or emoji 😊.

Advanced Prompts

More advanced prompts can include one or more image URLs, multiple text phrases, and one or more parameters

Image URLs can be added to a prompt to influence the style and content of the finished result. Image URLs always go at the front of a prompt.
Read more about Image Prompts
The text description of what image you want to generate. See below for prompting information and tips. Well-written prompts help generate amazing images.

Parameters change how an image generates. Parameters can change aspect ratios, models, upscalers, and lots more. Parameters go at the end of the prompt.
Read more about Parameters
Prompting Notes

Word Choice

Word choice matters. More specific synonyms work better in many circumstances. Instead of big, try tiny, huge, gigantic, enormous, or immense.

Plural words and Collective Nouns

Plural words leave a lot to chance. Try specific numbers. "Three cats" is more specific than "cats." Collective nouns also work, "flock of birds" instead of "birds."

Focus on What you Want

It is better to describe what you want instead of what you don't want. If you ask for a party with "no cake," your image will probably include a cake. To ensure an object is not in the final image, try advanced prompting using thee --no parameter.

Prompt Length and Details

Prompts can be simple. A single word or emoji will work. However, short prompts rely on Midjourney's default style, allowing it to fill in any unspecified details creatively. Include any element that is important to you in your prompt. Fewer details means more variety but less control.
Try to be clear about any context or details that are important to you. Think about:

Subject: person, animal, character, location, object

Medium: photo, painting, illustration, sculpture, doodle, tapestry

Environment: indoors, outdoors, on the moon, underwater, in the city

Lighting: soft, ambient, overcast, neon, studio lights

Color: vibrant, muted, bright, monochromatic, colorful, black and white, pastel

Mood: sedate, calm, raucous, energetic

Composition: portrait, headshot, closeup, birds-eye view

# data[].attributes.attachment_link.description
A Prompt is a text phrase that the Midjourney Bot interprets to produce an image. A well-crafted prompt can help make unique and exciting images.

# data[].attributes.headline
How to Write AI Art Prompts [Examples + Templates]

# data[].attributes.subject
How to Write AI Art Prompts [Examples + Templates]

# data[].attributes.attachment_link.provider_name
Social Media Marketing & Management Dashboard

# data[].attributes.attachment_link.title
How to write AI art prompts [examples + templates]

# data[].attributes.attachment_link.description
Creating cool AI art prompts isn’t as complicated as it might seem. You can use simple formulas to generate high-quality AI art.

# data[].attributes.attachment_link.description
Use this free tool to easily create powerful Midjourney prompts. Start generating beautiful images today with the Midjourney Prompt Helper.

# data[].attributes.attachment_link.readable_text
Trained on Adobe Stock images, openly licensed content, and public domain content, Firefly is designed to be safe for commercial use. To ensure that creators can benefit from generative AI, we've developed a compensation model for Adobe Stock contributors whose content is used in the dataset to retrain Firefly models.

# data[].attributes.attachment_link.title
Adobe Firefly - Generative AI for everyone

# data[].attributes.attachment_link.description
Use simple text prompts in 100+ languages to experiment and create extraordinary images, text styles, color schemes, and more with the Adobe Firefly web app.

# data[].attributes.attachment_link.description
Contribute to microsoft/prompts-for-edu development by creating an account on GitHub.

# data[].attributes.attachment_link.description
Check out this Presentation designed by dawnlberkeley.

# data[].attributes.attachment_link.title
Emergent Abilities of Large Language Models

# data[].attributes.attachment_link.description
Scaling up language models has been shown to predictably improve performance and sample efficiency on a wide range of downstream tasks. This paper instead discusses an unpredictable phenomenon that we refer to as emergent abilities of large language models. We consider an ability to be emergent if it is not present in smaller models but is present in larger models.

# data[].attributes.attachment_link.description
Large Language Models (LLMs) have achieved excellent performances in various tasks. However, fine-tuning an LLM requires extensive supervision. Human, on the other hand, may improve their reasoning abilities by self-thinking without external inputs. In this work, we demonstrate that an LLM is also capable of self-improving with only unlabeled datasets.