Shot prompting

Trabalhando com DeepSeek em Python

James Chapman

AI Curriculum Lead, DataCamp

Fornecendo exemplos

Um robô observa exemplos

  • Shot prompting
Trabalhando com DeepSeek em Python

O que é shot prompting?

Shot prompting: incluir exemplos para guiar as respostas da IA

$$

  • Zero-shot: sem exemplos, só instruções
  • One-shot: um exemplo guia a resposta
  • Few-shot: vários exemplos dão mais contexto

Representação de zero a few shots

Trabalhando com DeepSeek em Python

Por que shot prompting importa?

$$

✅ Casos de uso de shot prompting:

  • 📑 Classificação de texto
  • 💬 Análise de sentimento
  • 🔍 Extração de dados
  • ✨ ... e muitos outros!

Casos de uso de shot prompting

Trabalhando com DeepSeek em 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
Trabalhando com DeepSeek em 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
Trabalhando com DeepSeek em 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
Trabalhando com DeepSeek em Python

Vamos praticar!

Trabalhando com DeepSeek em Python

Preparing Video For Download...