我正在尝试用OpenAI提供的代码。
链接:- 用于文本生成的API
码
import openai
prompt = """We’re releasing an API for accessing new AI models developed by OpenAI. Unlike most AI systems which are designed for one use-case, the API today provides a general-purpose “text in, text out” interface, allowing users to try it on virtually any English language task. You can now request access in order to integrate the API into your product, develop an entirely new application, or help us explore the strengths and limits of this technology."""
response = openai.Completion.create(model="davinci", prompt=prompt, stop="\n", temperature=0.9, max_tokens=100)
print(response)我搞错了
误差
“必须提供'engine‘参数才能创建%s”% cls,"engine“。openai.error.InvalidRequestError:必须提供一个“engine”参数才能创建一个
我正在使用python 3.7.6
发布于 2021-01-25 06:44:39
看来你把发动机参数和模型参数搞混了。请查看此文档以获得正确的调用方式:https://beta.openai.com/docs/developer-quickstart/python-bindings
请把model = "davinci"换成engine = "davinci",你应该可以走了。
发布于 2022-01-01 15:57:08
如果您得到错误代码:
...
InvalidRequestError: Engine not found一个可能的问题可能是您的帐户设置不允许您访问引擎。例如,嵌入引擎只适用于“私有beta”。您可能需要为您的帐户请求访问它。以下代码可能会将可用的引擎转到您的帐户上:
import openai
openai.api_key = your_openai_api_key
data = openai.Engine.list() for eng in data['data']:
print(eng['id'])https://stackoverflow.com/questions/65667929
复制相似问题