logo
P
Prompt Master

Prompt 大师

掌握和 AI 对话的艺术

Sentiment Classification

zero-shot sentiment classification prompt

#背景

这个 prompt 用于测试 LLM 的 classification 能力:把一段文本分类为

code
neutral
/
code
negative
/
code
positive

#prompt

text
Classify the text into neutral, negative, or positive Text: I think the food was okay. Sentiment:

#template

text
Classify the text into neutral, negative, or positive Text: {input} Sentiment:

#API (example)

#GPT-4 (OpenAI)

python
from openai import OpenAI client = OpenAI() response = client.chat.completions.create( model="gpt-4", messages=[ { "role": "user", "content": "Classify the text into neutral, negative, or positive\nText: I think the food was okay.\nSentiment:\n" } ], temperature=1, max_tokens=256, top_p=1, frequency_penalty=0, presence_penalty=0 )
1v1免费职业咨询