ChatGPT插件例子 推文分类器
这是检测情绪的基本提示。
提问
确定推文的情绪是积极的、中性的还是消极的。推特:“我喜欢新的蝙蝠侠电影!”情绪:
回答
积极的
API请求
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.Completion.create(
model="text-davinci-003",
prompt="Decide whether a Tweet's sentiment is positive, neutral, or negative.\n\nTweet: \"I loved the new Batman movie!\"\nSentiment:",
temperature=0,
max_tokens=60,
top_p=1.0,
frequency_penalty=0.5,
presence_penalty=0.0
)