'OpenAI' object has no attribute 'responses'

Hi OpenAI Team,
i found there is an error in my code, especially when i call the responses. [response = client.responses.create(…)]

it siad ‘OpenAI’ object has no attribute ‘responses’

but the code just work for several day, just face it this morning.

thank you for the response.

See if the library employed is old.

import openai
client = openai.Client()
print(f"Used `openai` module version {openai.__version__}")
print(f"Using OPENAI_API_KEY {client.api_key}")
print(f"Using optional OPENAI_ORG_ID {client.organization}")
print(f"Using optional OPENAI_PROJECT_ID {client.project}")

Then you can go hardcore, forcing uninstall and reinstall of the library and dependencies:

pip install --force-reinstall "openai>1.80"

Check the path of your site-packages, ensure you run pip with the same rights as the original environment.

1 Like