何をすべきかモデルに指示することは、モデルの動作をカスタマイズする効果的かつ効率的な方法です。指示は明確、簡潔、直接的なものにします。必要なコンテキストを提供し、望ましい出力の概要を示します。指示には手順のリストのような単純なものもあれば、ユーザー エクスペリエンスやマインドセットを表すような複雑なものもあります。
効果的な指示を作成する方法
効果的な指示には、次の原則が適用されます。
- モデルに対応方法を伝えます。
 - 明確かつ具体的に記述します。
 - 出力の制約またはフォーマット要件を指定します。
 
例
たとえば、ハンバーガー屋を経営していて、最も人気があるメニューを把握するためにモデルを使用したいとします。メニュー項目を簡単に識別できるように、お客さまの注文時のセリフを 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"
        ]
      }
     | 
  
この例では、指示のルールを適用することで、データが多すぎるレスポンスが、このユースケースに必要なデータが正確に含まれているレスポンスに変わりました。指示のルールを使用する指示によって、ユースケースに最も有用なレスポンスを出力するモデルを導くことに役立ちます。
次のステップ
- プロンプトの他の例については、プロンプト ギャラリーをご覧ください。