mirror of
https://github.com/dair-ai/Prompt-Engineering-Guide
synced 2024-11-08 07:10:41 +00:00
40 lines
1.7 KiB
Plaintext
40 lines
1.7 KiB
Plaintext
# Elements of a Prompt
|
|
|
|
import {Bleed} from 'nextra-theme-docs'
|
|
|
|
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.
|
|
|
|
<iframe width="100%"
|
|
height="415px"
|
|
src="https://www.youtube.com/embed/kgBZhJnh-vk?si=-a-KvhmXFJMtAuCB" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
allowFullScreen
|
|
/>
|
|
|
|
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.
|
|
|
|
|