LoslegenKostenlos loslegen

Collaborative problem solving

With the new manufacturing workshop about to launch, Aurora’s registration site has slowed to 8–10 seconds per page load, which is putting off potential attendees. You turn to Claude for another multi-turn conversation: first report the slowdown, then add more detail so Claude can zero in on the bottleneck.

The anthropic library and client are preloaded.

Diese Übung ist Teil des Kurses

Introduction to Claude Models

Kurs anzeigen

Anleitung zur Übung

  • Report the initial problem: "My website loads slowly, taking 8-10 seconds".
  • Provide additional diagnostic details, "The slowdown happens only on the homepage with the image gallery".
  • Add the messages parameter to the second API call.

Interaktive Übung

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

messages = []

# Add initial problem report
messages.append({"role": "user", "content": ____})

response1 = client.messages.create(model="claude-3-7-sonnet-latest", max_tokens=150, messages=messages)

# Simulate Claude asking follow-up questions, then provide more details
messages.append({"role": "assistant", "content": response1.content[0].text})
messages.append({"role": "user", "content": ____})

# Get final troubleshooting advice
response2 = client.messages.create(model="claude-3-7-sonnet-latest", max_tokens=200, ____)
Code bearbeiten und ausführen