어시스턴트 역할 활용하기

Python으로 DeepSeek 활용하기

James Chapman

AI Curriculum Lead, DataCamp

단일 턴 작업

response = client.chat.completions.create(
  model="deepseek-ai/DeepSeek-V4.1-Flash",
  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?"}]
)
  • System: 어시스턴트의 _행동_{{1}}을 제어
  • User: 어시스턴트에게 _지시_
  • Assistant: 사용자 지시에 대한 응답
Python으로 DeepSeek 활용하기

예시 제공하기

 

  • 모델을 올바른 방향으로 유도
  • 어시스턴트 메시지를 제공하는 것은 더 체계적인 형태의 shot-prompting
  • 예시: Python 프로그래밍 튜터
    • 사용자 질문과 답변 예시

데이터 사이언스 부엉이.

Python으로 DeepSeek 활용하기

예시 제공하기

response = client.chat.completions.create(
  model="deepseek-ai/DeepSeek-V4.1-Flash",
  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 활용하기

System vs. assistant vs. user

System → 중요한 템플릿 형식 지정

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

Assistant → 예시 대화

User → 새로운 입력에 필요한 맥락(흔히 단일 턴)

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...