logo
P
Prompt Master

Prompt 大师

掌握和 AI 对话的艺术

Elements

instruction / context / input data / output indicator

如果你接触过大量 prompt engineering 相关的示例和应用,你会注意到一个

code
prompt
往往由一些要素组成。

code
prompt
可以包含以下任意要素:

  • instruction:想要模型执行的特定任务或指令
  • context:包含外部信息或额外的上下文信息,引导 LLM 更好地响应
  • input data:用户输入的内容或问题
  • output indicator:指定输出的类型或格式

为了更好地演示 prompt 要素,下面是一个简单的 prompt,旨在完成文本分类任务:

Prompt

code
Classify the text as neutral, negative, or positive. Text: I think the food is okay. Sentiment:

在上面的示例中,instruction 是“将文本分类为 neutral、negative 或 positive”。input data 是 “我觉得食物还可以” 部分,output indicator 是 “Sentiment:”。请注意,此基本示例不使用 context,但你也可以把 context 作为 prompt 的一部分提供,例如提供更多 examples,以帮助模型更好地理解任务并引导预期输出。

注意,prompt 所需的格式取决于你想要 LLM 完成的任务类型,并非所有以上要素都是必须的。

1v1免费职业咨询