mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 19:57:04 +08:00
14 lines
440 B
Python
14 lines
440 B
Python
import openai
|
|
|
|
openai.api_key = "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"
|
|
|
|
resp = openai.Completion.create(
|
|
prompt="user:你好,今天天气怎么样?\nbot:",
|
|
model="text-davinci-003",
|
|
temperature=0.9, # 数值越低得到的回答越理性,取值范围[0, 1]
|
|
top_p=1, # 生成的文本的文本与要求的符合度, 取值范围[0, 1]
|
|
frequency_penalty=0.2,
|
|
presence_penalty=1.0,
|
|
)
|
|
|
|
print(resp) |