어시스턴트 역할 활용하기

Python으로 DeepSeek 활용하기

James Chapman

AI Curriculum Lead, DataCamp

단일 턴 작업

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

예시 제공하기

 

  • 모델을 올바른 방향으로 유도
  • 어시스턴트 메시지 제공은 더 구조화된 형태의 샷 프롬프팅
  • 예시: Python 프로그래밍 튜터
    • 예시 사용자 질문 및 답변

데이터 사이언스 올빼미.

Python으로 DeepSeek 활용하기

예시 제공하기

response = client.chat.completions.create(
  model="deepseek-ai/DeepSeek-V4-Pro",
  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...