시작하기무료로 시작하기

리뷰를 활용한 제로샷 프롬프팅

질문에 답하고 텍스트를 변환하거나 새로운 텍스트를 생성하는 것 외에도, DeepSeek 모델은 카테고리 분류나 감성 분석과 같은 분류 작업에도 활용할 수 있습니다.

이번 연습 문제에서는 온라인 신발 매장인 Toe-Tally Comfortable의 리뷰를 사용해 DeepSeek를 채팅 모드에서 감성 분류에 활용하는 방법을 알아봅니다. 이상적으로는 다음과 같은 형태의 결과물을 얻고자 합니다:

1. Review text = <1-5 rating>
2. Review text = <1-5 rating>
3. ...

이 연습은 강의의 일부입니다

Python으로 DeepSeek 활용하기

강의 보기

연습 안내

  • 제공된 문장들의 감성을 1부터 5까지의 숫자(긍정에서 부정 순)로 분류하는 prompt를 정의하세요— 아직 예시는 제공하지 마세요!
  • 이 프롬프트를 deepseek-ai/DeepSeek-V4-Pro-0813에 전송하는 요청을 생성하세요.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

client = OpenAI(api_key="", base_url="https://api.together.xyz/v1")

# Define a multi-line prompt to classify sentiment
prompt = """____. Return no explanations:
1. Unbelievably good!
2. Shoes fell apart on the second use.
3. The shoes look nice, but they aren't very comfortable.
4. Can't wait to show them off!"""

# Create a request to the chat model
response = client.chat.completions.create(
  model="deepseek-ai/DeepSeek-V4-Pro-0813",
  messages=[{"role": "user", "content": ____}],
  max_tokens=500
)

print(response.choices[0].message.content)
코드 편집 및 실행