ज़रूरत के अनुसार उत्तर जनरेट करना
अब जबकि ग्राहक की क्वेरी moderation पास कर चुकी है, तो चलिए एक ज़रूरत के अनुसार उत्तर जनरेट करते हैं.
चैटबॉट को सटीक जवाब देने में मदद करने के लिए, आप उसे प्रासंगिक संदर्भ देंगे. दो डॉक्युमेंट उपलब्ध हैं:
faqs: सामान्य ग्राहक सवाल और उनके जवाबcontent_overview: संबंधित ट्रैक्स, जिनमें descriptions और links शामिल हैं
Corrected transcript अभी भी corrected_text के रूप में उपलब्ध है
यह अभ्यास पाठ्यक्रम का हिस्सा है
OpenAI API के साथ मल्टी-मॉडल सिस्टम
अभ्यास निर्देश
- ऐसा prompt पूरा करें जो स्पष्ट निर्देश दे और संदर्भ के लिए
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)