Aan de slagGa gratis aan de slag

Conversation roles for customer support

BrightCart’s live-chat traffic has doubled since launching the new interface. You’re training a support bot to handle simple FAQs instantly but escalate anything that needs account access or deep tech fixes. For example, the bot can handle questions such as password resets and shipping ETAs, but billing errors or app crashes much be handed off to a human agent.

Give Claude a few example turns that lock in this behavior so customers always get quick help from the bot, or a smooth transfer to specialists.

The anthropic library, client, and customer_question variable are pre-loaded.

Deze oefening maakt deel uit van de cursus

Introduction to Claude Models

Cursus bekijken

Oefeninstructies

  • Set the role for the assistant's helpful response to the password question.
  • Write an escalation response that directs billing issues to human support.
  • Add the customer question using the user role.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

messages = [
    {"role": "user", "content": "How do I reset my password?"},
    # Show how the bot handles simple questions
    {"role": ____, "content": "Click 'Forgot Password' on the login page, enter your email, and check for our reset link."},
    {"role": "user", "content": "Why is my account being charged twice?"},
    # Demonstrate escalation for billing issues
    {"role": "assistant", "content": ____},
    # Add the new customer question for the bot to handle
    {"role": ____, "content": customer_question}]

response = client.messages.create(
    model="claude-sonnet-4-0", max_tokens=75,
    messages=messages)

print(response.content[0].text)
Code bewerken en uitvoeren