텍스트 생성

Python으로 DeepSeek 활용하기

James Chapman

AI Curriculum Lead, DataCamp

출력은 어떻게 생성되나요?

  • 대화를 완성할 가능성이 가장 높은 텍스트
response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro",

messages=[{"role": "user", "content": "Hi! I'm James and I'm a Curriculum Manager at DataCamp."}]
) print(response.choices[0].message.content)
Hi James! It's great to meet you. As a **Curriculum Manager at DataCamp**, you must
play a key role in shaping the learning experience for data science and analytics
students. How can I assist you today?
  • 응답은 비결정론적(본질적으로 무작위)입니다
Python으로 DeepSeek 활용하기

의미상 유사한 두 요청을 받는 고객 지원 챗봇.

Python으로 DeepSeek 활용하기

응답 무작위성 제어

  • temperature: _결정론* 제어, 0(매우 결정론적)에서 2(매우 무작위)
  • 추론 활성화 시 자동으로 무시됨 → 사용하려면 비활성화
response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro",
    extra_body={"thinking": {"type": "disabled"}},
    messages=[{"role": "user",
             "content": "Hi! I'm James and I'm a Curriculum Manager at DataCamp."}],

temperature=2
) print(response.choices[0].message.content)
Hi James! Welcome to DataCamp - it's great to connect with someone who works on
shaping learning experiences for data skills. What does your role typically involve
as a Curriculum Manager at **DataCamp?** Perhaps one-on95 kWielpulses.Z.blog.from...
Python으로 DeepSeek 활용하기

텍스트 생성: 마케팅

prompt = "Generate a powerful tagline for a new electric vehicle 
that highlights innovation and sustainability."
response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro",
    messages=[{"role": "user", "content": prompt}]
)

print(response.choices[0].message.content)
**"Drive the Future - Zero Emissions, Infinite Innovation."**  
This tagline captures the essence of cutting-edge technology and eco-conscious...
Python으로 DeepSeek 활용하기

응답 정리하기

prompt = "Generate a powerful tagline for a new electric vehicle 
that highlights innovation and sustainability. Return only the tagline
without formatting."

# Create a request to the chat model
# ...
"Drive the Future - Clean, Smart, Electric."
Python으로 DeepSeek 활용하기

텍스트 생성: 상품 설명

prompt = """Write a compelling e-commmerce product description for the UltraFit
Smartwatch in paragraph form. Highlight its key features:

10-day battery life, 24/7 heart rate and sleep tracking, built-in GPS, water
resistance up to 50 meters, and lightweight design.

Use a persuasive and engaging tone to appeal to fitness enthusiasts and busy
professionals.
"""

response = client.chat.completions.create( model="deepseek-ai/DeepSeek-V4-Pro", messages=[{"role": "user", "content": prompt}])
Python으로 DeepSeek 활용하기

텍스트 생성: 상품 설명

print(response.choices[0].message.content)
"The UltraFit Smartwatch is your all-in-one health and fitness companion. 
Stay on top of your wellness with 24/7 heart rate and sleep tracking, 
while the built-in GPS keeps you on course during runs. 
With a 10-day battery life, you can track your progress without constant recharging. 
Designed for both workouts and daily wear, its  lightweight build and 50-meter
water resistance make it the perfect smartwatch for an active lifestyle."
  • 반복하세요! 프롬프트에 세부 사항을 추가하고 요청을 다시 실행하세요
  • 다음 영상 → 모델에 예시 제공
Python으로 DeepSeek 활용하기

연습해 봅시다!

Python으로 DeepSeek 활용하기

Preparing Video For Download...