openai-python icon indicating copy to clipboard operation
openai-python copied to clipboard

ImportError: cannot import name 'ComputerCallOutput' from 'openai.types.responses'

Open guunergooner opened this issue 9 months ago • 1 comments

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • [x] This is an issue with the Python library

Describe the bug

While using the openai-python SDK, I attempted to import the ComputerCallOutput data structure from openai.types.responses, but encountered the following error:

Traceback (most recent call last):
  File "/Users/gooner/Workbench/repo/github.com/browser-use/browser-use/apiserver.py", line 47, in <module>
    from openai.types.responses import ComputerCallOutput
ImportError: cannot import name 'ComputerCallOutput' from 'openai.types.responses' (/Users/gooner/Workbench/repo/github.com/browser-use/browser-use/.venv/lib/python3.11/site-packages/openai/types/responses/__init__.py)

It seems that ComputerCallOutput is not available in the openai.types.responses module, possibly due to a mismatch between the documentation and the codebase, or the data structure not being properly exposed.

To Reproduce

  • Steps to Reproduce

    • Install the openai-python SDK (e.g., via pip install openai).
    • Create a Python script with the following code:
      from openai.types.responses import ComputerCallOutput
    
    • Run the script and observe the error.
  • Environment Operating System: macOS Python Version: 3.11 OpenAI SDK Version: 1.67.0

Code snippets

from openai.types.responses import ComputerCallOutput

OS

macOS

Python version

Python 3.11.11

Library version

openai 1.67.0

guunergooner avatar Mar 20 '25 12:03 guunergooner

Hi,

I've noticed that there are two instances of ComputerCallOutput in our codebase—one in src/openai/types/responses/response_input_item_param.py and the other in src/openai/types/responses/response_input_param.py. Since both definitions are identical, I've consolidated them by importing the one from response_input_param.py in our __init__.py file as follows:

from .response_input_param import ComputerCallOutput as ComputerCallOutput

I've created a PR with this change. (#2248)

Could you also clarify which documentation you were referring to? For now, you can import ComputerCallOutput directly using:

from openai.types.responses.response_input_param import ComputerCallOutput

Thanks for your feedback!

prdai avatar Mar 22 '25 03:03 prdai

I did not report any errors in this way

from openai.types.responses.response_input_param import ComputerCallOutput

Thanks

guunergooner avatar Apr 13 '25 02:04 guunergooner