Shot-промптинг

Работа с DeepSeek на Python

James Chapman

AI Curriculum Lead, DataCamp

Примеры в запросах

Робот смотрит на примеры

  • Shot-промптинг
Работа с DeepSeek на Python

Что такое shot-промптинг?

Shot-промптинг: включение примеров для управления ответами ИИ

$$

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

Представление zero- и few-shot

Работа с DeepSeek на Python

Зачем нужен shot-промптинг?

$$

✅ Применение shot-промптинга:

  • 📑 Классификация текста
  • 💬 Анализ тональности
  • 🔍 Извлечение данных
  • ✨ ... и многое другое!

Применение shot-промптинга

Работа с DeepSeek на Python

Zero-shot промптинг

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 промптинг

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 промптинг

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...