어시스턴트 역할 활용하기

Python으로 DeepSeek 활용하기

James Chapman

AI Curriculum Lead, DataCamp

단일 턴 작업

response = client.chat.completions.create(
  model="deepseek-ai/DeepSeek-V4-Pro-0813",
  messages=[{"role": "system",
             "content": "You are a Python programming tutor who responds using concise,
                         one-sentence explanations."},
            {"role": "user",
             "content": "What is the difference between mutable and immutable objects?"}]
)
  • 시스템: 어시스턴트의 _동작_ 제어
  • 사용자: 어시스턴트에게 _지시_
  • 어시스턴트: 사용자 지시에 대한 응답
Python으로 DeepSeek 활용하기

예시 제공하기

 

  • 모델을 올바른 방향으로 유도
  • 어시스턴트 메시지 제공은 더 체계적인 형태의 샷 프롬프팅(shot-prompting) 입니다
  • 예시: Python 프로그래밍 튜터
    • 사용자 질문 및 답변 예시

데이터 사이언스 부엉이.

Python으로 DeepSeek 활용하기

예시 제공하기

response = client.chat.completions.create(
  model="deepseek-ai/DeepSeek-V4-Pro-0813",
  messages=[{"role": "system",
             "content": "You are a Python programming tutor who responds using concise,
                         one-sentence explanations."},

{"role": "user", "content": "How do you define a Python list?"},
{"role": "assistant", "content": "Lists are defined by enclosing a comma-separated sequence of objects inside square brackets [ ]."},
{"role": "user", "content": "What is the difference between mutable and immutable objects?"}] )
Python으로 DeepSeek 활용하기

응답

print(response.choices[0].message.content)
Mutable objects can be changed after creation (like lists), while immutable objects cannot
(like tuples or strings).
  • 예시 개수를 실험해 보세요
Python으로 DeepSeek 활용하기

시스템 vs. 어시스턴트 vs. 사용자

시스템 → 중요한 템플릿 형식

Output the information in this format:
name | age | occupation

어시스턴트 → 예시 대화

사용자 → 새로운 입력에 필요한 컨텍스트(주로 단일 턴)

Create a job advert for an AI Engineer. Use this job advert as a template:

Job Title: Data Engineer
...
Python으로 DeepSeek 활용하기

연습해 봅시다!

Python으로 DeepSeek 활용하기

Preparing Video For Download...