3일차: AI 프롬프트 기법 (파트 1)

발행: (2026년 5월 4일 PM 12:15 GMT+9)
3 분 소요
원문: Dev.to

Source: Dev.to

Day 3: Prompting Techniques in AI (Part 1) 표지 이미지

AI 프롬프트 기법: 제로샷, 원샷, 퓨샷

ChatGPT와 다른 AI 도구들을 사용하면서, 나는 프롬프트가 단순히 AI 모델이 마법처럼 처리하는 텍스트 입력이라고 생각했었다. 내 Day 1 글에서 언급했듯이, AI 모델은 다음 단어 예측기이며, 사고를 하는 존재가 아니다. 모델은 훈련 데이터에 기반해 예측한다(하지만 최신 모델은 실시간 검색 및 도구 호출을 사용해 더 나은 결과를 제공한다).

기본 사항

AI 모델로부터 응답을 얻기 위한 가장 간단한 Python 코드 스니펫:

response = client.responses.create(
    model="gpt-5-nano",
    input=[
        {"role": "system", "content": SYSTEM_PROMPT},
        {"role": "user", "content": "How do I reverse a list in Python?"},
    ]
)

가장 중요한 점: role 키는 system, user, assistant 세 가지 값만 가질 수 있다. 시스템 프롬프트는 모델의 행동을 설정한다.

1. 제로샷 프롬프트

예시 없이 시스템 프롬프트에 지시만 제공:

SYSTEM_PROMPT = """
You are a helpful assistant that only answers Python programming questions.
If the user asks about anything else, politely decline.
"""

2. 원샷 프롬프트

모델이 어떻게 응답해야 하는지에 대한 하나의 예시를 제공:

input = [
    {"role": "system", "content": SYSTEM_PROMPT},
    {"role": "user", "content": "What is the capital of France?"},
    {"role": "assistant", "content": "I'm sorry, I can only help with Python programming questions."},
    {"role": "user", "content": "How do I reverse a list in Python?"},
]

3. 퓨샷 프롬프트

여러 개의 예시를 제공해 모델이 보다 정확하게 응답하도록 함:

input = [
    {"role": "system", "content": SYSTEM_PROMPT},
    {"role": "user", "content": "How to code a binary tree in Python?"},
    {"role": "assistant", "content": "Sure, here's an implementation..."},
    {"role": "user", "content": "What is the weather today?"},
    {"role": "assistant", "content": "I'm sorry, I can only help with Python programming questions."},
    {"role": "user", "content": "What is the capital of France?"},
    {"role": "assistant", "content": "I'm sorry, I can only help with Python programming questions."},
    {"role": "user", "content": "Why is 75% attendance required for the exam?"},
]

따라서 AI 엔지니어링에 입문하려는 초보자는 AI와 무작정 대화하는 것이 아니라 자신만의 AI 제품을 위한 시스템 프롬프트를 설계하는 사고 방식으로 전환해야 한다.

링크:
Day 1Day 2

0 조회
Back to Blog

관련 글

더 보기 »