Shot prompting

Lavorare con DeepSeek in Python

James Chapman

Curriculum Manager, DataCamp

Fornire esempi

Un robot guarda degli esempi

  • Shot prompting
Lavorare con DeepSeek in Python

Cos'è lo shot prompting?

Shot prompting: includere esempi per guidare le risposte dell'IA

$$

  • Zero-shot: nessun esempio, solo istruzioni
  • One-shot: un esempio guida la risposta
  • Few-shot: più esempi danno più contesto

Da zero a pochi esempi

Lavorare con DeepSeek in Python

Perché conta lo shot prompting?

$$

✅ Casi d'uso dello shot prompting:

  • 📑 Classificazione del testo
  • 💬 Analisi del sentiment
  • 🔍 Estrazione dati
  • ✨ ... e molti altri!

Casi d'uso dello shot prompting

Lavorare con DeepSeek in 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
Lavorare con DeepSeek in 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
Lavorare con DeepSeek in 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
Lavorare con DeepSeek in Python

Passiamo alla pratica !

Lavorare con DeepSeek in Python

Preparing Video For Download...