生成定制化回复
既然客户咨询已经通过内容审核,现在该生成一条定制化回复了。
为帮助聊天机器人更准确地作答,您将提供相关上下文。有两份文档可用:
faqs:常见客户问答content_overview:相关学习路径,包含描述和链接
修订后的通话文本仍保存在 corrected_text 中
本练习是课程的一部分
使用 OpenAI API 的多模态系统
练习说明
- 完成提示语,给出清晰指令,并将
faqs与content_overview两份文档作为上下文包含进去。 - 使用
gpt-4o-mini模型生成回复,发送instruction_prompt作为 system 消息,corrected_text作为 user 消息。
交互式实操练习
通过完成这段示例代码来试试这个练习。
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)