Get startedGet started for free

Generating a tailored response

Now that the customer inquiry passed moderation, it's time to generate a tailored response.

To help the chatbot respond accurately, you'll provide it with relevant context. Two documents are available:

  • faqs: common customer questions and answers
  • content_overview: relevant tracks, including descriptions and links

The corrected transcript is still available as corrected_text

This exercise is part of the course

Multi-Modal Systems with the OpenAI API

View Course

Exercise instructions

  • Complete the prompt that gives clear instructions and includes the faqs and content_overview documents for context.
  • Use the gpt-4o-mini model to generate a response, sending instruction_prompt as a system message and corrected_text as a user message.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

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)
Edit and Run Code