Skip to content

AttributeError: module 'openai' has no attribute 'ChatCompletion' #246

@monk1337

Description

@monk1337

Describe the bug

The feature was working few hours ago, now it's giving error.

To Reproduce

import openai

openai.api_key = 'key'

openai.ChatCompletion.create(
  model="gpt-3.5-turbo",
  messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Who won the world series in 2020?"},
        {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
        {"role": "user", "content": "Where was it played?"}
    ]
)

Code snippets

No response

OS

macOS

Python version

Python v3.7.1

Library version

openai v0.26.5

no function as ChatCompletion the defined methods

import openai
print(openai.__dir__())

['name', 'doc', 'package', 'loader', 'spec', 'path', 'file', 'cached', 'builtins', 'annotations', 'os', 'Optional', 'error', 'util', 'version', 'openai_response', 'api_requestor', 'openai_object', 'api_resources', 'Answer', 'Classification', 'Completion', 'Customer', 'Edit', 'Deployment', 'Embedding', 'Engine', 'ErrorObject', 'File', 'FineTune', 'Image', 'Model', 'Moderation', 'Search', 'APIError', 'InvalidRequestError', 'OpenAIError', 'api_key', 'api_key_path', 'organization', 'api_base', 'api_type', 'api_version', 'verify_ssl_certs', 'proxy', 'app_info', 'enable_telemetry', 'ca_bundle_path', 'debug', 'log', 'all']

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions