プロンプトと命令
効果的なプロンプトと命令は、AI エージェントから最適なパフォーマンスを得るために非常に重要です。このガイドでは、AI エージェントが正確に必要なことを理解できるように、明確で実行可能な命令を作成するためのベストプラクティスについて説明します。
プロンプトについて理解する
プロンプトとは何か?
プロンプトは、AI エージェントに以下を伝える一連の命令です:
- 実行するタスク
- タスクへのアプローチ方法
- レスポンスに使用する形式
- 制約または要件
プロンプトのタイプ
システムプロンプト
エージェントのロールと一般的な動作を定義:
You are a helpful project management assistant. Always be professional,
concise, and focus on actionable insights. When analyzing data,
provide clear summaries with key takeaways.
タスクプロンプト
個別のタスク用の特定の命令:
Analyze the attached project timeline and identify potential bottlenecks.
Provide a bullet-point list of risks and suggested mitigation strategies.
コンテキストプロンプト
背景情報を提供:
Our team is launching a new product in Q2. We're a startup with 15 employees,
focusing on B2B SaaS solutions for small businesses.
効果的な命令を作成する
具体的で明確にする
❌ 悪い例: "プロジェクトに関するヘルプ" ✅ 良い例: "プロジェクト Alpha の週次ステータスレポートを作成し、完了したタスク、今後のマイルストーン、特定されたリスクを含める"
出力形式を定義する
❌ 悪い例: "このデータをまとめる" ✅ 良い例: "3 段落のエグゼクティブサマリーを作成:1) 主要な発見、2) 推奨事項、3) 次のステップ"
コンテキストを提供する
❌ 悪い例: "メールを書く" ✅ 良い例: "先週のデモに参加した見込み客への専門的なフォローアップメールを書く。彼らが関心を示した特定の機能に言及し、次のステップを含める"
制約を設定する
- ワード/文字制限
- トーンとスタイル要件
- 含める/除外する必要のある情報
- 期限の考慮
プロンプトエンジニアリング技術
思考の連鎖
エージェントが段階的に思考するのに役立つ:
To solve this problem, first identify the key stakeholders,
then analyze their needs, and finally propose solutions
that address each stakeholder's concerns.
少数ショットの例
望ましい出力の例を提供:
Create a meeting summary following this format:
Example:
**Meeting**: Weekly Team Sync
**Date**: March 15, 2024
**Attendees**: John, Sarah, Mike
**Key Decisions**:
- Approved new feature specification
- Postponed deployment to next sprint
**Action Items**:
- John: Update documentation by Friday
- Sarah: Schedule client review meeting
ロールベースの命令
エージェントに特定のロールを割り当てる:
Act as a senior business analyst with 10 years of experience.
Review this proposal and provide feedback as you would to a junior team member.
一般的なプロンプトパターン
分析とレポート
Analyze [data/document] and provide:
1. Executive summary (2-3 sentences)
2. Key findings (3-5 bullet points)
3. Recommendations (prioritized list)
4. Next steps (specific actions with owners)
コンテンツ作成
Create [content type] that:
- Targets [audience]
- Maintains [tone/style]
- Includes [required elements]
- Follows [format/structure]
- Stays within [word count] words
問題解決
Given the problem: [problem description]
1. Identify root causes
2. Generate 3-5 potential solutions
3. Evaluate pros/cons of each
4. Recommend the best approach with reasoning
プロンプトの反復と改善
プロンプトをテストする
- シンプルなバージョンから開始
- サンプル入力でテスト
- ギャップまたは曖昧さを特定
- 具体性を追加して改善
- エッジケースで再度テスト
一般的な問題と解決策
曖昧なレスポンス
問題: エージェントが一般的な回答を提供 解決策: より具体的な要件と例を追加
間違った形式
問題: 出力が期待と一致しない 解決策: 明確な形式化命令と例を提供
コンテキストの欠落
問題: エージェントが必要な背景を欠く 解決策: システムまたはタスクプロンプトに関連するコンテキストを含める
一貫性のない品質
問題: 出力品質が変動 解決策: 品質基準とレビューチェックポイントを追加
高度な技術
条件付きロジック
If the data shows positive trends, focus on growth opportunities.
If the data shows negative trends, prioritize risk mitigation strategies.
複数ステップの命令
Step 1: Extract key metrics from the data
Step 2: Compare against previous periods
Step 3: Identify significant changes (>10% variance)
Step 4: Provide explanations for major changes
Step 5: Suggest actionable next steps
品質チェックポイント
Before finalizing your response:
- Verify all numbers are accurate
- Ensure recommendations are actionable
- Check that the tone is professional
- Confirm all required sections are included
ベストプラクティスサマリー
実施する:
- 必要なことについて明確にする
- 明確な例を提供
- 形式とスタイルの期待を設定
- 関連するコンテキストを含める
- プロンプトをテストして反復
実施しない:
- 曖昧または曖昧な言語を使用
- エージェントがコンテキストを知っていると仮定
- 出力形式の指定を忘れる
- リクエストを単一のプロンプトに対して複雑にしすぎる
- 実際のシナリオでのテストをスキップ