샷 프롬프팅

OpenAI API 활용하기

James Chapman

Curriculum Manager, DataCamp

예시 제공하기

예시를 보는 로봇

  • 샷 프롬프팅
OpenAI API 활용하기

샷 프롬프팅이란 무엇인가요?

샷 프롬프팅: AI 응답을 안내하는 예시 포함

$$

  • 제로샷: 예시 없이 지시만
  • 원샷: 하나의 예시가 응답 안내
  • 퓨샷: 여러 예시에서 더 많은 맥락 제공

제로샷에서 퓨샷까지의 표현

OpenAI API 활용하기

샷 프롬프팅이 왜 중요할까요?

$$

✅ 샷 프롬프트의 사용 사례:

  • 📑 텍스트 분류
  • 💬 감성 분석
  • 🔍 데이터 추출
  • ✨ ... 그 외!

샷 프롬프팅의 사용 사례

OpenAI API 활용하기

제로샷 프롬프팅

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. Meal was decent, but I've had better. - 3 (Neutral)
2. My food was delayed, but drinks were good. - 3 (Neutral)
OpenAI API 활용하기

원샷 프롬프팅

prompt = """Classify sentiment as 1-5 (bad-good) in the following statements:
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. ->
"""
1. The service was very slow -> 1
2. Meal was decent, but I've had better. -> 3
3. My food was delayed, but drinks were good. -> 4
OpenAI API 활용하기

퓨샷 프롬프팅

prompt = """Classify sentiment as 1-5 (bad-good) in the following statements:
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. ->
"""
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. -> 4
5. My food was delayed, but drinks were good. -> 3
OpenAI API 활용하기

일반 분류

prompt = """Classify the following animals as Land, Sea, or Both:
1. Blue whale
2. Polar bear
3. Salmon
4. Dog
"""
1. **Blue whale** - Sea
2. **Polar bear** - Both (primarily land but is a marine mammal that lives in sea ice)
3. **Salmon** - Both (spends part of its life in freshwater and part in the ocean)
4. **Dog** - Land
OpenAI API 활용하기
prompt = """Classify the following animals as Land, Sea, or Both:
1. Zebra = Land
2. Crocodile = Both
3. Blue whale = 
4. Polar bear = 
5. Salmon = 
6. Dog = 
"""
1. Zebra = Land
2. Crocodile = Both
3. Blue whale = Sea
4. Polar bear = Both
5. Salmon = Sea
6. Dog = Land
OpenAI API 활용하기

연습해 봅시다!

OpenAI API 활용하기

Preparing Video For Download...