阅读背景:

GPT-3 API接口调用

来源:互联网 
import os import openai # # openai.api_key = "sk-t你自己的API key" # response = openai.Completion.create( # model="text-davinci-003", # #prompt="Translate this into 1. French, 2. Spanish and 3. Japanese:\n\nWhat rooms do you have available?\n\n1.", # prompt="Translate this into English:\n\n操你妈呀!\n\n1.", # temperature=0.3, # max_tokens=100, # top_p=1.0, # frequency_penalty=0.0, # presence_penalty=0.0 # ) # print(response) # # openai.api_key = os.getenv("sk-t你自己的API key"") # 这个会报错 # openai.api_key = "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" # 这个不报错 # 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"] # ) # print(response) openai.api_key = "sk-t你自己的API key"" # 这个不报错 response = openai.Completion.create( model="text-davinci-003", prompt="The following is a list of companies and the categories they fall into:\n\nApple, Facebook, Fedex\n\nApple\nCategory:", temperature=0, max_tokens=64, top_p=1.0, frequency_penalty=0.0, presence_penalty=0.0 ) print(response) import os import openai # # openai.api_key = "sk-



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: