Prompt-Engineering-Guide/pages/introduction/elements.en.mdx
2023-12-24 14:26:33 -06:00

32 lines
1.5 KiB
Plaintext

# Elements of a Prompt
As we cover more and more examples and applications with prompt engineering, you will notice that certain elements make up a prompt.
A prompt contains any of the following elements:
**Instruction** - a specific task or instruction you want the model to perform
**Context** - external information or additional context that can steer the model to better responses
**Input Data** - the input or question that we are interested to find a response for
**Output Indicator** - the type or format of the output.
To demonstrate the prompt elements better, here is a simple prompt that aims to perform a text classification task:
*Prompt*
```
Classify the text into neutral, negative, or positive
Text: I think the food was okay.
Sentiment:
```
In the prompt example above, the instruction correspond to the classification task, "Classify the text into neutral, negative, or positive". The input data corresponds to the "I think the food was okay.' part, and the output indicator used is "Sentiment:". Note that this basic example doesn't use context but this can also be provided as part of the prompt. For instance, the context for this text classification prompt can be additional examples provided as part of the prompt to help the model better understand the task and steer the type of outputs that you expect.
You do not need all the four elements for a prompt and the format depends on the task at hand. We will touch on more concrete examples in upcoming guides.