Если, например, я пишу:
Код: Выделить всё
import openai
openai.api_key = "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
lista_de_modelos = openai.Model.list()
print(lista_de_modelos)
Код: Выделить всё
PS C:\\proyectoVS_Python\> & "C:/Users/kitkatuser/AppData/Local/Programs/Python/Python312/python.exe" "c:/proyectoVS_Python/import os.py"
Traceback (most recent call last):
File "c:\\proyectoVS_Python\\import os.py", line 5, in \
lista_de_modelos = openai.Model.list()
^^^^^^^^^^^^^^^^^
File "C:\\Users\\kitkatuser\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\openai_utils_proxy.py", line 22, in __getattr__
return getattr(self.__get_proxied__(), attr)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\\Users\\kitkatuser\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\openai_utils_proxy.py", line 43, in __get_proxied__
return self.__load__()
^^^^^^^^^^^^^^^
File "C:\\Users\\kitkatuser\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\openai\\lib_old_api.py", line 33, in __load__
raise APIRemovedInV1(symbol=self.\_symbol)
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
PS C:\\proyectoVS_Python\>
Подробнее здесь: https://stackoverflow.com/questions/774 ... nger-suppo