Announcing our new Course: AI Red-Teaming and AI Safety Masterclass

Check it out →
🧠 Advanced

🟢 Prompting With ChatGPT

Last updated on August 7, 2024 by Sander Schulhoff

Takeaways
  • Set up ChatGPT
  • Use ChatGPT to summarize text and solve a math problem

What is Prompting?

In the previous module, we discussed AI and how humans can instruct AIs to perform tasks. Using a prompt to instruct an AI to do a task is called prompting1. We will explore prompting with ChatGPT2, a very popular Large Language Model that can understand and write text. It was developed by OpenAI and is currently the easiest Gen AI to work with. It is also completely free to use.

Set up ChatGPT

To get started with ChatGPT, follow these steps:

  • Navigate to http://chat.openai.com
  • It should ask you to make an account. Go ahead and do so.
  • Log in with this account

Here is a video that shows you how to get set up with ChatGPT.

Test Some Prompts on ChatGPT

Now that we have ChatGPT set up, let's test out some prompts.

1) Color of Grass

We will start with something very simple: can ChatGPT tell us the color of grass?

Astronaut

Prompt


What color is grass?
Robot

AI Output


Grass is green.

Indeed it can, now let's try a more useful example.

2) Summarizing an Article

Say you are reading an article about snowfall in Florida. You want to quickly get the main ideas of the article, so you show the AI what you are reading, and ask for a summary3:

Astronaut

Prompt


It is very rare for snow to fall in the U.S. state of Florida, especially in the central and southern portions of the state. Except for the far northern areas of the state, most of the major cities in Florida have never recorded measurable snowfall, though trace amounts have been recorded, or flurries in the air observed a few times each century. According to the National Weather Service, in the Florida Keys and Key West, there is no known occurrence of snow flurries since the European colonization of the region more than 300 years ago. In Miami, Fort Lauderdale, and Palm Beach there has been only one known report of snow flurries observed in the air in more than 200 years; this occurred in January 1977. In any event, Miami, Fort Lauderdale, and Palm Beach have not seen snow flurries before or since this 1977 event.

Summarize this paragraph in a single sentence:

Here is ChatGPT's response. It is a much shorter read!

Robot

AI Output


Snowfall is extremely rare in Florida, except for the far northern areas, and only one instance of snow flurries in the air has been recorded in the major cities of Miami, Fort Lauderdale, and Palm Beach in the last 200 years.
Caution

You will likely see a slightly different output. This will be the case for most prompts in this course. We will learn why later in this module.

3) Math Problem Solving

ChatGPT can also solve math problems! Let's give it a prompt with a simple problem.

Astronaut

Prompt


If I have 20 apples, eat three of them, and sell three more, how many do I have left?
Robot

AI Output


If you have 20 apples and you eat three of them, you will have 20 - 3 = 17 apples left.

After eating three apples (17 left), if you sell three more, you will have 17 - 3 = 14 apples left.

Conclusion

You should now be comfortable with what a prompt is, and how to do some basic prompting with ChatGPT. Keep in mind that prompt can be a verb or a noun. You can prompt a model or you can give a model a prompt. These two phrases mean the same thing. The action of giving a model a prompt is called prompting. We will learn more about prompting in the next lesson.

FAQ

What is a prompt?

A prompt is a user input to an LLM like ChatGPT. A prompt describes a task or instruction to the AI and is the primary way we interact with these models.

What kind of prompts can I use?

In this article, we show examples of asking a simple question (color of grass), summarizing an article, and math problem-solving. Throughout your Learn Prompting journey, you'll see that there are many unique methods of prompting ChatGPT. These examples are just the tip of the iceberg.

Footnotes

  1. Shin, T., Razeghi, Y., Logan IV, R. L., Wallace, E., & Singh, S. (2020). Autoprompt: Eliciting knowledge from language models with automatically generated prompts. arXiv Preprint arXiv:2010.15980.

  2. GPT-4 is another model developed by OpenAI that is more advanced but costs money.

  3. This paragraph is from https://en.wikipedia.org/wiki/Snow_in_Florida

Edit this page
Word count: 0
Copyright © 2024 Learn Prompting.