这是indexloc提供的服务,不要输入任何密码
Skip to content

Bug: Deprecated OpenAI package breaks setup #6

@sibbl

Description

@sibbl

The integration cannot be added. The following exception is thrown when adding the API key.

Unexpected exception

Traceback (most recent call last):
  File "/config/custom_components/openai_control/config_flow.py", line 83, in async_step_user
    await validate_input(self.hass, user_input)
  File "/config/custom_components/openai_control/config_flow.py", line 63, in validate_input
    await hass.async_add_executor_job(partial(openai.Engine.list, request_timeout=10))
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/openai/lib/_old_api.py", line 39, in __call__
openai.lib._old_api.APIRemovedInV1: 

You tried to access openai.Engine, 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions