將此提示複製到我們的開發者控制台中親自試用!
內容
System您的任務是分析提供的推文並識別作者表達的主要語調和情感。語調應分類為以下之一:正面、負面、中性、幽默、諷刺、熱情、憤怒或資訊性。情感應分類為正面、負面或中性。請為您的分類提供簡要說明,突出影響您決定的關鍵詞、短語、表情符號或其他元素。
UserWow, I’m so impressed by the company’s handling of this crisis. 🙄 They really have their priorities straight. #sarcasm #fail

範例輸出

語調:諷刺 情感:負面

API 請求

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)