

下記のコードを入力すると下記のように出ました。  
ご教授いただけると幸いです。

**エラーメッセージ:**

[code]

    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
    
[/code]

**コード:**

[code]

    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)
    
[/code]


CC BY-SA 4.0
2023-11-18T08:26:42.140
96818
2023-11-18T11:47:23.313
2023-11-18T11:47:23.313
3060
58934
question
python
LangChainを使ったアプリ開発のためのOpenAIをインストールしましたが、エラーが出ます。どのように解決したらよいですか？