LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Introduction to Claude Models

Kurs anzeigen

Anleitung zur Übung

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

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

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-3-7-sonnet-latest", max_tokens=75,
    messages=messages)

print(response.content[0].text)
Code bearbeiten und ausführen