시작하기무료로 시작하기

맞춤형 응답 생성

고객 문의가 모더레이션을 통과했으니, 이제 맞춤형 응답을 생성해 볼까요?

챗봇이 정확하게 답변하도록 관련 문맥을 제공할 거예요. 다음 두 문서를 사용할 수 있습니다:

  • faqs: 자주 묻는 질문과 답변
  • content_overview: 관련 트랙(설명과 링크 포함)

교정된 전사본은 여전히 corrected_text로 제공됩니다.

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

OpenAI API로 만드는 멀티모달 시스템

강의 보기

연습 안내

  • faqscontent_overview 문서를 문맥으로 포함하고, 명확한 지침을 제공하는 프롬프트를 완성하세요.
  • gpt-4o-mini 모델을 사용해 응답을 생성하고, 시스템 메시지로 instruction_prompt, 사용자 메시지로 corrected_text를 전송하세요.

실습형 인터랙티브 연습

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

client = OpenAI(api_key="")

# Complete the prompt
instruction_prompt = f"""
#### Role
You are a professional AI support assistant for DataCamp. You help with:
- Sales (pricing, plans, billing)
- Content (courses, recommendations, feedback)
- Marketing (partnerships, collaborations)

#### How to Respond
1. Use the FAQs: ____
2. Use the content overview: ____
3. Respond clearly and concisely in up to 3 paragraphs.
4. If unsure, direct the user to [email protected].
"""

# Generate response
response = ____

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