提供模型指令,說明該如何執行特定動作,是自訂模型行為的有效方式。指令應清楚、簡潔且直接,並提供所需脈絡資料,以及說明預期輸出內容。指令可以簡單列出逐步操作說明,也可以複雜到需要繪製使用者體驗和思維。
如何撰寫有效指令
有效的指令會遵循下列原則:
- 告訴模型要做什麼。
- 力求清楚明確。
- 指定輸出內容的任何限制或格式規定。
範例
舉例來說,假設您經營起司漢堡餐廳,並想使用模型瞭解最受歡迎的菜單項目。您希望模型以 JSON 格式提供顧客訂單的轉錄稿,方便您快速找出菜單項目。下表說明模型在收到一般指示和遵循指示原則的具體指示時,會提供哪些不同的回覆:
| 一般操作說明 |
|---|
Extract the transcript in JSON.
Transcript:
Speaker 1 (Customer): Hi, can I get a cheeseburger and large fries, please?
Speaker 2 (Restaurant 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 (Restaurant 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"
]
}
|
套用指令原則後,這個範例從包含過多資料的回覆,變成只包含這個用途所需的資料。遵循指令原則的指令可引導模型,針對您的用途提供最實用的回覆。
後續步驟
- 如要查看更多提示範例,請前往提示庫。