İhtiyaca yönelik yanıt oluşturma
Müşteri talebi moderasyondan geçtiğine göre, şimdi ihtiyaca yönelik bir yanıt üretme zamanı.
Chatbot'un doğru yanıt vermesine yardımcı olmak için ona ilgili bağlam sağlayacaksın. İki doküman mevcut:
faqs: sık sorulan müşteri soruları ve yanıtlarıcontent_overview: açıklamalar ve bağlantılarla birlikte ilgili track'ler
Düzeltilmiş döküm hâlâ corrected_text olarak mevcut
Bu egzersiz
OpenAI API ile Çok Modlu Sistemler
kursunun bir parçasıdırEgzersiz talimatları
- Açık talimatlar veren ve bağlam için
faqsilecontent_overviewdokümanlarını içeren istemi tamamla. - Yanıt üretmek için
gpt-4o-minimodelini kullan;instruction_promptsistem mesajı,corrected_textise kullanıcı mesajı olarak gönder.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
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)