開始使用免費開始

用 Claude 進行分析型問題解決

在你的促銷活動成功後,網站流量成長了 40%,但付費訂閱卻只增加 5%。啟用 Claude 的進階思考來拆解這個落差:詳細的分析將為 SkyTrack 的下一波成長衝刺提供方向。

已預先載入 anthropic 函式庫與 client

本練習屬於課程

Claude 模型入門

檢視課程

練習說明

  • 建立一個分析型思考的提示。
  • 在你的 API 呼叫中使用 thinking 參數來開啟進階思考。
  • max_tokens 設為較大的值,例如 1400,以提供 Claude 足夠的推理與作答空間。
  • 列印分析結果。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Create an analytical thinking prompt
analysis_prompt = """
Analyze this business scenario and walk me through your reasoning:
Our website traffic increased 40% but sales only grew 5%.
___
Provide multiple possible explanations and rank them by likelihood.
"""

# Request detailed analytical thinking
response = client.messages.create(model="claude-sonnet-4-6", thinking=____, max_tokens=____, messages=[{"role": "user", "content": analysis_prompt}])
# Print the analysis results
print("Analysis results:")
print(response.content[0].thinking)
編輯並執行程式碼