通过向模型提供关于要做什么的指令,可以有效且高效地自定义模型行为。指令要清晰、简洁、直接,提供所需的上下文并概述所需的输出。指令可以很简单,比如分步说明列表;也可以很复杂,例如反映用户的体验和思维模式。
如何撰写有效的说明
有效说明遵循以下原则:
- 告知模型要执行的操作。
- 明确具体。
- 指定输出的任何限制条件或格式要求。
示例
例如,假设您拥有一家奶酪汉堡店,并且想使用一个模型来帮助您了解哪些菜单项最受欢迎。您希望模型采用 JSON 格式设置客户订单转写内容的格式,以便快速识别菜单项。下表显示了模型在提供通用说明和遵循说明原则的具体说明时提供的不同回答:
通用说明 |
---|
Extract the transcript in JSON. Transcript: Speaker 1 (Customer): Hi, can I get a cheeseburger and large fries, please? Speaker 2 (Resturaunt employee): Coming right up! Anything else you'd like to add to your order? Speaker 1: Hmmm, maybe a small orange juice. And could I get the fries with ketchup on the side? Speaker 2: No problem, one cheeseburger, one large fries with ketchup on the side, and a small orange juice. That'll be $5.87. Drive through to the next window please. { "speakers": [ { "speaker": "Customer", "utterances": [ "Hi, can I get a cheeseburger and large fries, please?" ] }, { "speaker": "Restaurant Employee", "utterances": [ "Coming right up! Anything else you'd like to add to your order?" ] }, { "speaker": "Customer", "utterances": [ "Hmm, maybe a small orange juice. And could I get the fries with ketchup on the side?" ] }, { "speaker": "Restaurant Employee", "utterances": [ "No problem, one cheeseburger, one large fries with ketchup on the side, and a small orange juice. That'll be $5.87. Drive through to the next window please." ] } ] } |
具体说明 |
---|
Extract the items from this transcript in JSON and separate drinks from food. Transcript: Speaker 1 (Customer): Hi, can I get a cheeseburger and large fries, please? Speaker 2 (Resturaunt employee): Coming right up! Anything else you'd like to add to your order? Speaker 1: Hmmm, maybe a small orange juice. And could I get the fries with ketchup on the side? Speaker 2: No problem, one cheeseburger, one large fries with ketchup on the side, and a small orange juice. That'll be $5.87. Drive through to the next window please. { "drinks": [ "orange juice" ], "food": [ "cheeseburger", "large fries" ] } |
通过应用说明原则,此示例从包含过多数据的回答转变为仅包含此使用场景所需数据的回答。使用说明原则的说明可帮助您指导模型为您的使用场景提供最有用的回答。
后续步骤
- 在提示库中探索更多提示示例。