Claude を使った分析的解決
プロモーションが成功した結果、ウェブサイトのトラフィックは 40% 増加しましたが、有料サブスクリプションの増加はわずか 5% にとどまっています。Claude の拡張思考を活用してこの乖離を分析しましょう。詳細な分析結果が、SkyTrack の次の成長戦略を導く指針となります。
anthropic ライブラリと client はあらかじめ読み込まれています。
この演習はコースの一部です
Claude モデル入門
演習の手順
- 分析用の思考プロンプトを作成してください。
- API の呼び出しで
thinkingパラメータを使用して、拡張思考を有効にします。 - Claude が推論と回答を十分に展開できるよう、
max_tokensには 1400 などの大きな値を設定してください。 - 分析結果を出力してください。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# 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)