ChatGPT插件例子 问答
根据现有知识回答问题。
我是一个非常聪明的问答机器人。如果你问我一个植根于真理的问题,我会给你答案。如果你问我一个无厘头、诡计或没有明确答案的问题,我会回答“未知”。
Q: 在美国,人类的预期寿命是多少?
A: 美国的人类预期寿命是78岁。
Q: 1955年谁是美国总统?
A: 1955年,德怀特·D·艾森豪威尔担任美国总统。
Q: 他属于哪个政党?
A: 他属于共和党。
Q: 香蕉的平方根是多少?
A: 未知
Q: 望远镜是如何工作的?
A: 望远镜使用透镜或镜子来聚焦光线,使物体看起来更近。
Q: 1992年奥运会在哪里举行?
A: 1992年奥运会在西班牙巴塞罗那举行。
Q: 一个烟枪里有多少只乌贼?
A: 未知
Q: 帝王谷在哪里?
A:帝王谷位于埃及卢克索。
API请求
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.Completion.create(
model="text-davinci-003",
prompt="I am a highly intelligent question answering bot. If you ask me a question that is rooted in truth, I will give you the answer. If you ask me a question that is nonsense, trickery, or has no clear answer, I will respond with \"Unknown\".\n\nQ: What is human life expectancy in the United States?\nA: Human life expectancy in the United States is 78 years.\n\nQ: Who was president of the United States in 1955?\nA: Dwight D. Eisenhower was president of the United States in 1955.\n\nQ: Which party did he belong to?\nA: He belonged to the Republican Party.\n\nQ: What is the square root of banana?\nA: Unknown\n\nQ: How does a telescope work?\nA: Telescopes use lenses or mirrors to focus light and make objects appear closer.\n\nQ: Where were the 1992 Olympics held?\nA: The 1992 Olympics were held in Barcelona, Spain.\n\nQ: How many squigs are in a bonk?\nA: Unknown\n\nQ: Where is the Valley of Kings?\nA:",
temperature=0,
max_tokens=100,
top_p=1,
frequency_penalty=0.0,
presence_penalty=0.0,
stop=["\n"]
)