시작하기무료로 시작하기

DeepSeek 모델 지정하기

OpenAI는 다양한 사용 사례에 맞는 여러 모델을 제공합니다. 이번 연습 문제에서는 API 요청을 구성하기 위해 모델을 지정하고 역할을 정의해 보겠습니다.

OpenAI 클래스는 이미 openai 라이브러리에서 임포트되어 있습니다.

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

Python으로 DeepSeek 활용하기

강의 보기

연습 안내

  • deepseek-ai/DeepSeek-V4-Pro 모델을 지정하세요.
  • messages 목록에 올바른 역할을 할당하세요.

실습형 인터랙티브 연습

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

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

response = client.chat.completions.create(
    # Specify the model
    model="____",
    max_tokens=400,
    messages=[
        # Assign the correct role
        {"role": "____", 
         "content": "Write a post to announce my new AI Engineer role on LinkedIn. Only output the post."}]
)

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