将此提示复制到我们的开发者控制台中,亲自尝试!

内容
System你的任务是分析提供的推文并识别作者表达的主要语调和情感。语调应该被归类为以下之一:积极、消极、中性、幽默、讽刺、热情、愤怒或信息性。情感应该被归类为积极、消极或中性。提供一个简短的解释来说明你的分类,突出显示影响你决定的关键词、短语、表情符号或其他元素。
User哇,我对公司处理这次危机的方式印象深刻。🙄 他们真的把优先事项安排得很好。#讽刺 #失败

示例输出

语调:讽刺 情感:消极

API 请求

import anthropic

client = anthropic.Anthropic(
    # 默认为 os.environ.get("ANTHROPIC_API_KEY")
    api_key="my_api_key",
)
message = client.messages.create(
    model="claude-opus-4-20250514",
    max_tokens=1000,
    temperature=0,
    system="Your task is to analyze the provided tweet and identify the primary tone and sentiment expressed by the author. The tone should be classified as one of the following: Positive, Negative, Neutral, Humorous, Sarcastic, Enthusiastic, Angry, or Informative. The sentiment should be classified as Positive, Negative, or Neutral. Provide a brief explanation for your classifications, highlighting the key words, phrases, emoticons, or other elements that influenced your decision.",
    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)