1. Learn
  2. /
  3. Courses
  4. /
  5. Prompt Engineering with the OpenAI API

Connected

Exercise

Behavioral control of a customer support chatbot

When the company started using your chatbot from the previous exercise, they realized they'd like to incorporate two conditions to improve its interactions: they want the customer support chatbot to ask for an order number if not provided, and to express empathy for customers going through technical issues.

They've assigned this update to you. You need to append these conditions to the base_system_prompt that represents the prompt you engineered in the previous exercise and obtain a refined_system_prompt. You will test the chatbot on two queries.

The OpenAI package, the base_system_prompt string developed in the previous exercise, and the get_response() function have been pre-loaded for you.

Instructions

100 XP
  • Ask the user for their order number if they submitted a query about an order without specifying an order number; save this to order_number_condition.
  • Define a technical_issue_condition where you tell the model to start the response with I'm sorry to hear about your issue with ... if the user is reporting a technical issue.
  • Create the refined_system_prompt that combines the base_system_prompt and the two new conditions.