下記のコードを入力すると下記のように出ました。
ご教授いただけると幸いです。
エラーメッセージ:
You tried to access openai.Completion, but this is no longer
supported in openai>=1.0.0 - see the README at
https://github.com/openai/openai-python for the API.
You can run `openai migrate` to automatically upgrade your codebase to
use the 1.0.0 interface.
Alternatively, you can pin your installation to the old version, e.g.
`pip install openai==0.28`
A detailed migration guide is available here:
https://github.com/openai/openai-python/discussions/742
コード:
import os
import openai
os.environ["OPENAI_API_KEY"] = "XXXXXXXXXXXXX"
response = openai.Completion.create(
model = "gpt-3.5-turbo",
message = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Who won the 2020 NBA finals?"},
]
)
print(response)