转载

ChatGPT插件例子 好友聊天

模拟短信对话。

提问

你:你最近在忙什么?

朋友:看老电影。

你:你有没有看到什么有趣的东西?

朋友:

回答

是的,我看了一部叫做卡萨布兰卡的老经典。真的很棒!

API请求

<font size="3">import os
import openai

openai.api_key = os.getenv("OPENAI_API_KEY")

response = openai.Completion.create(
  model="text-davinci-003",
  prompt="You: What have you been up to?\nFriend: Watching old movies.\nYou: Did you watch anything interesting?\nFriend:",
  temperature=0.5,
  max_tokens=60,
  top_p=1.0,
  frequency_penalty=0.5,
  presence_penalty=0.0,
  stop=["You:"]
)</font>