joselcaguilar / azure-openai-ha

Azure OpenAI Conversation for Home Assistant
MIT License
43 stars 6 forks source link

openai.Model no longer supported #75

Open vcdx71 opened 4 months ago

vcdx71 commented 4 months ago

Attempting to configure this integration throws the following error in the logs.

HA: 2024.6.4

This error originated from a custom integration.

Logger: custom_components.azure_openai_conversation.config_flow Source: custom_components/azure_openai_conversation/config_flow.py:91 integration: Azure OpenAI Conversation (documentation, issues) First occurred: 3:33:27 PM (5 occurrences) Last logged: 4:08:57 PM

Unexpected exception Traceback (most recent call last): File "/config/custom_components/azure_openai_conversation/config_flow.py", line 91, in async_step_user await validate_input(self.hass, user_input) File "/config/custom_components/azure_openai_conversation/config_flow.py", line 71, in validate_input await hass.async_add_executor_job(partial(openai.Model.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.Model, 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