プロンプト設計パターンを確認する
学習の目的
この単元を完了すると、次のことができるようになります。
- 主要な 4 つのプロンプト設計パターンを特定する。
- 各パターンをさまざまなビジネス上の問題解決に適用する。
- タスクに応じてどのパターンを使用するかを認識する。
- 実際のシナリオを使ってパターンマッチングを練習する。
プロンプト設計パターンについて学ぶ
プロンプト設計パターンとは、特定の種類のタスクに再利用できるテンプレートです。ソフトウェア開発のデザインパターンと同様に、プロンプトパターンは一般的な問題を一貫した方法で解決します。
たとえば、パン職人がパン生地をこねて、形を整え、発酵させるという定番の工程を踏むように、プロンプトデザイナーも作業時に基本となる一連のパターンを使用します。最適なパターンは、タスクごとに異なります。プロンプトデザイナーがプロンプトを作成するときの工程を、料理のレシピになぞらえてみましょう。
- 要約: レシピ全体を大まかな手順に絞り込みます。
- コンテンツ生成: 手元にある食材のリストから新しいレシピを作成します。
- 変換: アレルギーなどの食事制限やほかの料理との組み合わせを考慮してレシピを変更します。
- 抽出: レシピカード全体から食材リストだけを取り出します。
パターン 1: 要約
目的: 大量の情報を短く理解しやすい形式にまとめます。
使用する状況: テキストが多く、要点をすばやく把握したい場合。
ユースケースの例:
- 長いケース履歴を 2 ~ 3 文に要約しする。
- 調査ドキュメントから重要な調査結果を抽出する。
- 長いメールスレッドから概要を作成する。
- ミーティングのメモをアクション項目にまとめる。
プロンプトの例:
Task: Summarize this customer support case """ Case Details: Customer complained about billing issue. We investigated and found an error in our system from their third billing cycle. The charge was $250 when it should have been $150. We've issued a refund and applied an additional $50 credit. Customer responded positively. """ Instructions: - Provide a 2-3 sentence summary - Include the problem, resolution, and customer response - Use clear, straightforward language - Focus on what matters most
パターン 2: コンテンツ生成
目的: 指定されたパラメーターに基づいて、新しいコンテンツを最初から作成します。
使用する状況: オリジナルコンテンツをすばやく生成する必要がある場合。
ユースケースの例:
- フォローアップメールを自動的に生成する。
- 商品説明を作成する。
- ソーシャルメディア投稿を書く。
- よくある質問への回答のドラフトを作成する。
プロンプトの例:
Task: Generate a follow-up email to a customer who purchased but hasn't used the product yet """ Customer: John Smith Product: Advanced Analytics Suite Days since purchase: 14 Customer's industry: Financial Services """ Instructions: - Write a friendly, non-pushy email - Offer to help them get started - Include one key benefit of the product - Add a link to a getting-started guide - Keep it under 150 words Format: Email with subject line
パターン 3: 変換
目的: 既存のコンテンツを別の対象者、トーン、目的に合わせて変更します。
使用する状況: 既存のコンテンツを別の形に変更する必要がある場合。
ユースケースの例:
- 技術ドキュメントを一般の利用者向けに書き直す。
- フォーマルなトーンを会話調に変更する。
- プラットフォーム (ソーシャルメディア、ブログなど) に合わせてコンテンツを変更する。
- 異なる地域向けにコンテンツをローカライズする。
プロンプトの例:
Task: Transform this technical error message into a user-friendly message """ Original error: "NullPointerException in AuthenticationManager.validate() at line 247" """ Instructions: - Remove technical jargon - Explain what went wrong in simple terms - Suggest what the user should do next - Keep a helpful, not alarming tone - Make it something a non-technical person would understand
パターン 4: 抽出
目的: 非構造化テキストから特定の情報を取り出します。
使用する状況: 大量のテキストから特定のデータポイントを見つける必要がある場合。
ユースケースの例:
- 会議メモからアクション項目を抽出する。
- メールから顧客の連絡先情報を取り出す。
- 長い提案書から主要な要件を特定する。
- ドキュメントに記載されているすべての期限を一覧にする。
プロンプトの例:
Task: Extract all action items and deadlines from this meeting transcript """ Meeting Transcript: Sarah mentioned we need to finalize the budget by March 30. John said he'd handle the vendor calls. We also discussed launching the new feature—target date is April 15. Maria will coordinate with design by March 22. """ Instructions: - List each action item - Include the responsible person if mentioned - Include the deadline if mentioned - Use a simple bullet-point format - If no deadline is mentioned, note "No deadline specified"
練習シナリオ Challenge
4 つのパターンを実際に確認したところで、 適切なパターンを見分ける力を試してみましょう。各シナリオを読んで、最も適切なパターンを選んでください。それぞれ正解は 1 つです。正しいパターンをシナリオにドラッグしてください。
プロンプトデザイナーにとって、この 4 つのパターンを使いこなせるようになることは非常に重要です。ビジネスのユースケースのほとんどは、この 4 つのいずれかで対応できるからです。パターンをすばやく見分けられるようになると、プロンプトの作成がずっと簡単になります。次の単元では、プロンプトに適したモデルを選択する方法を学びます。