Gemini : ガイド : プロンプト設計へのイントロダクション
作成 : クラスキャット セールスインフォメーション
作成日時 : 04/16/2024
* 本ページは、ai.google.dev の以下のページを独自に翻訳して、適宜、補足説明したものです :
* サンプルコードの動作確認はしておりますが、必要な場合には適宜、追加改変しています。
* ご自由にリンクを張って頂いてかまいませんが、sales-info@classcat.com までご一報いただけると嬉しいです。
- 人工知能研究開発支援
- 人工知能研修サービス(経営者層向けオンサイト研修)
- テクニカルコンサルティングサービス
- 実証実験(プロトタイプ構築)
- アプリケーションへの実装
- 人工知能研修サービス
- PoC(概念実証)を失敗させないための支援
- お住まいの地域に関係なく Web ブラウザからご参加頂けます。事前登録 が必要ですのでご注意ください。
◆ お問合せ : 本件に関するお問い合わせ先は下記までお願いいたします。
- クラスキャット セールス・マーケティング本部 セールス・インフォメーション
- sales-info@classcat.com ; Website: www.classcat.com ; ClassCatJP
Gemini : ガイド : プロンプト設計へのイントロダクション
プロンプト設計は、言語モデルから望ましい応答を導出する (elicit) プロンプトを作成する過程です。上手く構造化されたプロンプトを作成することは言語モデルから正確で高品質な応答を保証するために不可欠なパートです。このページは、プロンプトを設計し始めるためのいくつかの基本的な概念、ストラテジー、そしてベストプラクティスを紹介します。
プロンプトとは何か?
プロンプトは応答を受け取るために言語モデルに送信される自然言語のリクエストです。プロンプトはモデルが補完または継続するための質問、指示、コンテキスト情報、サンプルそして部分的な入力を含むことができます。モデルがプロンプトを受け取った後、使用されているモデルのタイプに依存して、テキスト、埋め込み、コード、画像、動画、音楽等を生成することができます。
プロンプトのコンテンツタイプ
プロンプトは以下のタイプのコンテンツの一つまたはそれ以上を含むことができます :
- 入力 (必須)
- コンテキスト (オプション)
- サンプル (オプション)
入力
入力は、そのためにモデルに応答を提供することを望む、プロンプトのテキストで、必須のコンテンツタイプです。入力は、モデルが回答する質問 (質問入力)、モデルが実行するタスク (タスク入力)、モデルがその上で動作するエンティティ (エンティティ入力)、あるいはモデルが補完したり継続する部分的な入力 (補完 (completion) 入力) でありえます。
質問入力
質問入力は、モデルがそのために回答を提供するように依頼する質問です。
プロンプト :
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
以上