Shot prompting

Робота з DeepSeek у Python

James Chapman

AI Curriculum Lead, DataCamp

Надання прикладів

Робот розглядає приклади

  • Shot prompting
Робота з DeepSeek у Python

Що таке shot prompting?

Shot prompting: додавання прикладів для спрямування відповідей ШІ

$$

  • Zero-shot: без прикладів, лише інструкції
  • One-shot: один приклад задає орієнтир
  • Few-shot: кілька прикладів дають більше контексту

Від нуля до кількох прикладів

Робота з DeepSeek у Python

Чому shot prompting важливий?

$$

✅ Де корисний shot prompting:

  • 📑 Класифікація тексту
  • 💬 Аналіз тональності
  • 🔍 Видобування даних
  • ✨ ... та багато іншого!

Застосування shot prompting

Робота з DeepSeek у Python

Zero-shot prompting

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
Робота з DeepSeek у Python

One-shot prompting

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
Робота з DeepSeek у Python

Few-shot prompting

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
Робота з DeepSeek у Python

Давайте потренуємось!

Робота з DeepSeek у Python

Preparing Video For Download...