Skip to content

Elements of a Prompt

Updated
17 Sept 2026
1 min read
3 sections
Page 5 of 25
Prompt Engineering Guide
Adapted from Prompting Guide: Elements of a Prompt — https://www.promptingguide.ai/introduction/elements
Embedded: https://www.youtube.com/embed/kgBZhJnh-vk?si=-a-KvhmXFJMtAuCB

What Makes Up a Prompt?

As you build more complex applications with LLMs, you'll notice that effective prompts typically consist of several distinct elements. While you don't need all of them for every task, combining them correctly is the key to prompt engineering.

A prompt can contain any of the following four elements:

  1. Instruction: A specific task or instruction you want the model to perform.
  2. Context: External information or additional background that can steer the model to better responses.
  3. Input Data: The specific input or question we are interested in finding a response for.
  4. Output Indicator: The desired type or format of the output (e.g., JSON, a list, a single word).

Example: Text Classification

To demonstrate these elements, let's look at a simple prompt designed for sentiment classification:

Prompt
md
Classify the text into neutral, negative, or positive.
Text: I think the food was okay.
Sentiment:

Breakdown of Elements:

  • Instruction: "Classify the text into neutral, negative, or positive."
  • Input Data: "I think the food was okay."
  • Output Indicator: "Sentiment:"
  • Context: In this basic example, no context is provided. However, you could add context by providing examples of previous classifications (few-shot prompting) to help the model better understand the nuances of your specific task.

Flexibility in Design

It's important to remember that you do not need all four elements for every prompt. The format depends entirely on the task at hand.

  • For a simple Question Answering task, you might only need an Instruction and Input Data.
  • For a Creative Writing task, you might rely heavily on Context and Instruction.
  • For Data Extraction, the Output Indicator becomes critical to ensure the results are machine-readable.

We will explore more concrete examples and how these elements interact in the upcoming sections.