我正在尝试 OpenAI 中给出的这段代码。
\n链接:-用于文本生成的 API
\n代码
\nimport openai\n\nprompt = """We\xe2\x80\x99re 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 \xe2\x80\x9ctext in, text out\xe2\x80\x9d 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."""\n\nresponse = openai.Completion.create(model="davinci", prompt=prompt, stop="\\n", temperature=0.9, max_tokens=100)\n\nprint(response)\nRun Code Online (Sandbox Code Playgroud)\n我收到错误
\n错误
\n\n\n"必须提供一个\'engine\'参数来创建 %s" % cls, "engine"。\nopenai.error.InvalidRequestError: 必须提供一个\'engine\'参数来创建一个<class \'openai.api_resources。完成.Completion\'>
\n
我正在使用 python 3.7.6
\nUjj*_*hal 10
看来您混淆了发动机参数和模型参数。请查看此文档以了解正确的调用方法:https://beta.openai.com/docs/developer-quickstart/python-bindings
请更改model = "davinci"为engine = "davinci"
,您应该可以出发了。
| 归档时间: |
|
| 查看次数: |
36168 次 |
| 最近记录: |