No history yet

Introduction to Prompt Engineering

Talking to an AI

Using an AI is a lot like having a conversation. You give it an instruction, and it gives you a response. That instruction is called a prompt. The skill of writing good prompts is called prompt engineering.

It's the same principle in prompt engineering, as detailed coffee orders lead to better coffee, specific good prompts can produce more relevant and refined AI responses.

Think about ordering coffee. If you just say "Give me coffee," you might get anything: black, with cream, iced, or a latte. But if you ask for a "large iced latte with oat milk and one pump of vanilla syrup," you'll get exactly what you want. The same idea applies to AI. The quality of what you get out depends directly on the quality of what you put in.

prompt

noun

An instruction or query given to an artificial intelligence model to generate a response.

This is important because there are many different kinds of AI models, and they all rely on your prompts to understand what to do. Some models, called Large Language Models (LLMs), are designed to work with text. You've probably heard of some of them, like OpenAI's GPT series, Anthropic's Claude, and Google's Gemini. They can write emails, summarize articles, and even create code.

Other models are built to generate images from text descriptions. DALL·E and Stable Diffusion are popular examples. You can ask them to create a picture of almost anything you can imagine.

Lesson image

How to Write a Good Prompt

You don't need to be a technical expert to write effective prompts. The core principle is simple: be clear and specific. An AI doesn't have common sense or the ability to read your mind. It only knows what you tell it. A vague prompt will almost always lead to a generic or unhelpful response.

The more specific and detailed your prompt is, the better your result will be.

A good prompt generally includes a few key ingredients:

  • Task: Tell the AI exactly what you want it to do. Do you want it to summarize, explain, list, translate, or create something new?
  • Context: Give the AI any background information it needs to complete the task. Who is the audience? What is the purpose of the output?
  • Format: Specify how you want the answer structured. Should it be a bulleted list, a paragraph, a table, or a JSON object?
  • Tone: Describe the desired style. Should the response be formal, friendly, professional, or humorous?
Vague PromptSpecific Prompt
Write about electric cars.Write three short paragraphs for a 5th-grade reader explaining the benefits of electric cars. Focus on environmental impact and cost savings. Use a friendly and encouraging tone.

Notice how the specific prompt leaves very little room for misinterpretation. It tells the AI the desired length, audience, key topics, and tone, which helps guide it toward a much more useful response.

A Foundational Skill

Learning the basics of prompt engineering is like learning how to use a new, powerful tool. By crafting your requests thoughtfully, you can get AI models to act as creative partners, research assistants, or helpful problem-solvers. Whether you're generating text with GPT-4 or creating images with DALL·E, a well-written prompt is the key to unlocking the AI's full potential.

Ready to check your understanding? Let's see what you've learned.

Quiz Questions 1/5

What is the instruction you give to an AI model called?

Quiz Questions 2/5

Which of the following is NOT a key ingredient of a good prompt mentioned in the text?

As you continue, you'll learn more advanced techniques, but these core principles of clarity and specificity will always be your starting point for effective communication with AI.