Fri Apr 14 14:24:00 UTC 2023 inscode

上级 df352508
print('欢迎来到 InsCode')
\ No newline at end of file
import openai
# 输入你的 api_key
chat_gpt_key = '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'
# 将 Key 进行传入
openai.api_key = chat_gpt_key
def completion(prompt):
response = openai.Completion.create(
# text-davinci-003 是指它的模型
model="text-davinci-003",
prompt=prompt,
temperature=0.5,
max_tokens=1024,
n=1,
stop=None
)
message = response.choices[0].text
return message
print(completion(input("在这里输入你想对chatgpt说的话,然后它就会给出答案:")))
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册