Nhắc lệnh theo "shot"

Làm việc với DeepSeek bằng Python

James Chapman

Curriculum Manager, DataCamp

Cung cấp ví dụ

Một robot đang xem ví dụ

  • Nhắc lệnh theo "shot"
Làm việc với DeepSeek bằng Python

Nhắc lệnh theo "shot" là gì?

Nhắc lệnh theo "shot": thêm ví dụ để định hướng phản hồi của AI

$$

  • Zero-shot: không có ví dụ, chỉ hướng dẫn
  • One-shot: một ví dụ dẫn dắt phản hồi
  • Few-shot: nhiều ví dụ cho thêm ngữ cảnh

Minh họa từ zero đến few shots

Làm việc với DeepSeek bằng Python

Vì sao shot prompting quan trọng?

$$

✅ Trường hợp dùng shot prompting:

  • 📑 Phân loại văn bản
  • 💬 Phân tích cảm xúc
  • 🔍 Trích xuất dữ liệu
  • ✨ ... và nhiều nữa!

Các trường hợp dùng shot prompting

Làm việc với DeepSeek bằng 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
Làm việc với DeepSeek bằng 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
Làm việc với DeepSeek bằng 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
Làm việc với DeepSeek bằng Python

Vamos praticar!

Làm việc với DeepSeek bằng Python

Preparing Video For Download...