ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Ingeniería de prompts para ChatGPT para desarrolladores

Ver curso

Instrucciones de ejercicio

  • 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.

Ejercicio interactivo práctico

Pruebe este ejercicio completando este código de muestra.

client = OpenAI(api_key="")

# Define the order number condition
order_number_condition = "____"

# Define the technical issue condition
technical_issue_condition = "____"

# Create the refined system prompt
refined_system_prompt = ____

response_1 = get_response(refined_system_prompt, "My laptop screen is flickering. What should I do?")
response_2 = get_response(refined_system_prompt, "Can you help me track my recent order?")

print("Response 1: ", response_1)
print("Response 2: ", response_2)
Editar y ejecutar código