การแก้ปัญหาร่วมกัน
เวิร์กชอปการผลิตใหม่กำลังจะเปิดตัว แต่เว็บไซต์ลงทะเบียนของ Aurora กลับโหลดช้าลงถึง 8–10 วินาทีต่อหน้า ซึ่งทำให้ผู้สนใจเข้าร่วมถอดใจไปหลายราย คุณจึงหันมาใช้ Claude ในการสนทนาแบบหลายรอบ โดยรายงานปัญหาความล่าช้าก่อน แล้วจึงเพิ่มรายละเอียดเพื่อให้ Claude ระบุจุดที่เป็นคอขวดได้อย่างแม่นยำ
ไลบรารี anthropic และ client ถูกโหลดไว้ให้แล้ว
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Claude Models เบื้องต้น
คำแนะนำการฝึกหัด
- รายงานปัญหาเบื้องต้น:
"My website loads slowly, taking 8-10 seconds" - ให้รายละเอียดการวินิจฉัยเพิ่มเติม:
"The slowdown happens only on the homepage with the image gallery" - เพิ่ม messages parameter เข้าไปในการเรียก API ครั้งที่สอง
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
messages = []
# Add initial problem report
messages.append({"role": "user", "content": ____})
response1 = client.messages.create(model="claude-sonnet-4-6", 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-sonnet-4-6", max_tokens=200, ____)