ショットプロンプティング

Python で DeepSeek を使いこなす

James Chapman

AI Curriculum Lead, DataCamp

例を示す

例を見ているロボット

  • ショットプロンプティング
Python で DeepSeek を使いこなす

ショットプロンプティングとは?

ショットプロンプティング:例を示してAIの応答を導く手法です

$$

  • ゼロショット:例を使わず、指示のみを与える方法
  • ワンショット:1つの例で応答を導く方法
  • フューショット:複数の例でより多くの文脈を提供する方法

ゼロショットからフューショットまでの図

Python で DeepSeek を使いこなす

なぜショットプロンプティングが重要なのか?

$$

✅ ショットプロンプティングの活用例:

  • 📑 テキスト分類
  • 💬 感情分析
  • 🔍 データ抽出
  • ✨ ほかにも多数!

ショットプロンプティングの活用例

Python で DeepSeek を使いこなす

ゼロショットプロンプティング

prompt = """Classify sentiment as 1-5 (bad-good) in the following statements:
1. Meal was decent, but I've had better.
2. My food was delayed, but drinks were good.
"""
...
1. 3  
2. 2
Python で DeepSeek を使いこなす

ワンショットプロンプティング

prompt = """Classify sentiment as 1-5 (bad-good) in the following statements. Return no
explanations:
1. The service was very slow -> 1
2. Meal was decent, but I've had better. ->
3. My food was delayed, but drinks were good. ->
"""
2. Meal was decent, but I've had better. -> 3  
3. My food was delayed, but drinks were good. -> 2
Python で DeepSeek を使いこなす

フューショットプロンプティング

prompt = """Classify sentiment as 1-5 (bad-good) in the following statements. Return no
explanations:
1. The service was very slow -> 1
2. The steak was awfully good! -> 5
3. It was ok, no massive complaints. -> 3
4. Meal was decent, but I've had better. ->
5. My food was delayed, but drinks were good. ->
"""
4. Meal was decent, but I've had better. -> 3  
5. My food was delayed, but drinks were good. -> 2
Python で DeepSeek を使いこなす

練習しましょう!

Python で DeepSeek を使いこなす

Preparing Video For Download...