提供清楚明確的指示

為模型提供指示,指出應採取的行動,是自訂模型行為的有效且有效率的方式。請提供清楚、簡明且直接的操作說明,提供必要的背景資訊,並概略說明預期的輸出內容。說明可以簡單到列出逐步操作說明,也可以複雜到繪製使用者體驗和心態。

如何撰寫有效的操作說明

有效的指示會遵循下列原則:

  • 告訴模型要執行哪些操作。
  • 清楚明確。
  • 指定輸出內容的任何限制或格式規定。

範例

舉例來說,假設您經營漢堡店,想使用模型瞭解哪些菜單項目最受歡迎。您希望模型以 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."
            ]
          }
        ]
      }
    
在這個範例中,一般指示會導致回應中的 JSON 欄位比您用來識別客戶訂購的選單項目還多。如以下表格所示,請設定更具體的輸出限制來改善指令:
具體操作說明
  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"
        ]
      }
    

在應用指示原則後,這個範例的回應內容從過多資料,變成只包含這個用途所需的資料。使用指令原則的指令可協助您引導模型,提供最符合用途的實用回覆。

後續步驟

  • 如要查看更多提示範例,請前往提示庫