プロンプト設計の概要

プロンプト設計は、言語モデルから望ましいレスポンスを引き出すプロンプトを作成するプロセスです。適切に構造化されたプロンプトを作成することは、言語モデルからの正確で高品質なレスポンスを実現するための不可欠な要素です。このページでは、プロンプトの設計を開始するための基本的なコンセプト、戦略、ベスト プラクティスについて説明します。

プロンプトとは

プロンプトとは、レスポンスを受け取るために言語モデルに送信される自然言語リクエストです。プロンプトには、モデルを完了または続行するための質問、手順、コンテキスト情報、例、部分入力を含めることができます。モデルは、使用しているモデルのタイプに応じてプロンプトを受信した後、テキスト、エンベディング、コード、画像、動画、音楽などを生成できます。

プロンプトのコンテンツ タイプ

プロンプトには、次のタイプのコンテンツを 1 つ以上含めることができます。

入力

入力は、モデルにレスポンスを提供させるプロンプトのテキストであり、必須のコンテンツ タイプです。入力は、モデルが回答する質問(質問入力)、モデルが実行するタスク(タスク入力)、モデルが動作するエンティティ(エンティティ入力)、またはモデルが完了または続行する部分入力(コンプリーション入力)のいずれかです。

質問の入力

質問入力とは、モデルに尋ねてモデルから回答を得るための質問です。


What's a good name for a flower shop that specializes in selling bouquets of
dried flowers?
  

1. Everlasting Blooms
2. Timeless Petals
3. Dried Flower Paradise
4. Eternal Flora
5. Vintage Floral Treasures
6. Rustic Bloom Gallery
7. Ardent Adornment
8. Potpourri Dreams
9. Dried Daisy Days
10. Forever Floral Art
  
タスク入力

タスク入力とは、モデルに実行させたいタスクです。たとえば、何かについてのアイデアや提案を示すようモデルに指示できます。


Give me a simple list of things that I must bring on a camping trip.
  

1. Tent
2. Sleeping bag
3. Sleeping pad
4. Pillow
5. Lantern or flashlight
6. Headlamp
7. Camp stove
8. Fuel for camp stove
9. Cooking pot and utensils
10. Food and water
11. First aid kit
12. Sunscreen
13. Insect repellent
14. Toiletries
15. Toilet paper
16. Fire starter
17. Map
18. Compass
19. Whistle
20. Multi-tool
21. Tarpaulin
22. Rope
23. Garbage bags
24. Camera
25. Binoculars
  
エンティティ入力

エンティティ入力とは、分類や要約などのアクションをモデルに実行させる際に対象となるものです。このタイプの入力では、指示を含めることで回答が改善することがあります。


Classify the following items as [large, small].
Elephant
Mouse
Snail
  

- Elephant: Large
- Mouse: Small
- Snail: Small
  
コンプリーション入力

コンプリーション入力とは、モデルに完成させる、または続きを生成させるためのテキストです。


Some simple strategies for overcoming writer's block include
  

1. **Take a Break:** Step away from your writing for a bit. Go for a walk, listen to music, or do something else that helps you relax and clear your mind. When you come back to your writing, you may find that your thoughts are more organized and your ideas are flowing more easily.

2. **Change Your Environment:** Sometimes, a change of scenery can help spark creativity. Try writing in a different location, such as a coffee shop, a library, or a park. Being in a new environment can help you see things from a different perspective and break out of your writer's block.

3. **Freewrite or Brainstorm:** Set a timer for 10-15 minutes and just write whatever comes to mind, without worrying about grammar or spelling. This can help you get started and generate new ideas. You can also try brainstorming by writing down a list of words or phrases that are related to your topic. This can help you to free associate and come up with new ideas.

4. **Read or Research:** Sometimes, the best way to overcome writer's block is to read or research your topic. Reading can help you to learn new things and get inspired. Research can help you to gather information and facts that you can use in your writing.

5. **Talk to Someone:** Talk to a friend, family member, or writing partner about what you're struggling with. Sometimes, just talking about your ideas can help you to clarify them and see them from a new perspective. You can also ask for feedback and suggestions, which can help you to move forward with your writing.

6. **Try a Different Writing Style:** If you're stuck in a rut, try experimenting with a different writing style. For example, if you're used to writing formal essays, try writing a poem or a short story. Changing your writing style can help you to break out of your comfort zone and come up with new ideas.

7. **Set a Deadline:** Sometimes, the best way to overcome writer's block is to set a deadline for yourself. This can help you to focus and motivate yourself to finish your writing. When you know that you have a deadline, you're more likely to start writing and keep going until you're finished.
  

コンテキスト

コンテキストは次のいずれかです。

  • モデルがどのように動作すべきかを指定する指示。
  • モデルが回答を生成するために使用または参照する情報。

モデルに情報を与える必要がある場合、または回答の範囲をプロンプト内の要素だけに制限する必要がある場合は、コンテキスト情報をプロンプトに追加します。


Marbles:
Color: red
Number: 12
Color: blue
Number: 28
Color: yellow
Number: 15
Color: green
Number: 17

How many green marbles are there?
  

There are 17 green marbles.
  

例は、モデルに理想的なレスポンスの例を与えるためにプロンプトに含める入力と出力のペアです。プロンプトに例を含めると、レスポンスの形式を効果的にカスタマイズできます。


Classify the following.
Options:
- red wine
- white wine

Text: Chardonnay
The answer is: white wine
Text: Cabernet
The answer is: red wine
Text: Moscato
The answer is: white wine

Text: Riesling
The answer is:
  

white wine
  

次のステップ