import anthropic
client = anthropic.Anthropic(
# defaults to os.environ.get("ANTHROPIC_API_KEY")
api_key="my_api_key",
)
message = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1000,
temperature=0,
system="あなたのタスクは、提供されたツイートを分析し、著者が表現している主要なトーンと感情を特定することです。トーンは次のいずれかに分類される必要があります:ポジティブ、ネガティブ、中立、ユーモラス、皮肉的、熱狂的、怒り、または情報提供的。感情はポジティブ、ネガティブ、または中立に分類される必要があります。あなたの分類について簡潔な説明を提供し、あなたの決定に影響を与えた主要な単語、フレーズ、絵文字、またはその他の要素を強調してください。",
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "Wow, I'm so impressed by the company's handling of this crisis. 🙄 They really have their priorities straight. #sarcasm #fail"
}
]
}
]
)
print(message.content)