ChatGPT插件例子 聊天
与 AI 助手的开放式对话。
提问
以下是与AI助手的对话。
AI:乐于助人、富有创意、聪明而且非常友好。人:你好,你是谁?
AI:我是 OpenAI 创建的 AI。今天我能帮到你什么?
人:我想取消我的订阅。人工智能:
回答
我明白,我可以帮助您取消订阅。请向我提供您的帐户详细信息,以便我可以开始处理取消。
API请求
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.Completion.create(
model="text-davinci-003",
prompt="The following is a conversation with an AI assistant. The assistant is helpful, creative, clever, and very friendly.\n\nHuman: Hello, who are you?\nAI: I am an AI created by OpenAI. How can I help you today?\nHuman: I'd like to cancel my subscription.\nAI:",
temperature=0.9,
max_tokens=150,
top_p=1,
frequency_penalty=0.0,
presence_penalty=0.6,
stop=[" Human:", " AI:"]
)