Skip to content

AttributeError: module 'openai' has no attribute 'openai_response' #240

@kaanbursa

Description

@kaanbursa

Describe the bug

Just ran the documentation code on Jupyter notebook and got
in python3.9/site-packages/openai/util.py:112
if isinstance(resp, openai.openai_response.OpenAIResponse):
113 organization = resp.organization
114 response_ms = resp.response_ms

AttributeError: module 'openai' has no attribute 'openai_response'

To Reproduce

pip install -U openai
in jupyter notebook

Code snippets

import openai

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?"}
    ]
)

OS

macOS m1

Python version

Python v3.9.12

Library version

openai-python v0.27.0

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