voxel51 / voxelgpt

AI assistant that can query visual datasets, search the FiftyOne docs, and answer general computer vision questions
https://gpt.fiftyone.ai
Apache License 2.0
234 stars 17 forks source link

openai>=1.0.0 compatibility #108

Closed gurucharansrinivas closed 9 months ago

gurucharansrinivas commented 1 year ago

Using VoxelGPT with Openai>=1.0.0 results in following error; You tried to access openai.Moderation, 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

Traceback (most recent call last): File "/fiftyone/default/plugins/@voxel51/voxelgpt/init.py", line 166, in execute for response in ask_voxelgpt_generator( File "/fiftyone/default/plugins/@voxel51/voxelgpt/voxelgpt.py", line 250, in ask_voxelgpt_generator if not moderate_query(query): File "/fiftyone/default/plugins/@voxel51/voxelgpt/links/query_moderator.py", line 14, in moderate_query return get_moderator().run(query) File "/usr/local/lib/python3.8/dist-packages/langchain/chains/base.py", line 505, in run return self(args[0], callbacks=callbacks, tags=tags, metadata=metadata)[ File "/usr/local/lib/python3.8/dist-packages/langchain/chains/base.py", line 310, in call raise e File "/usr/local/lib/python3.8/dist-packages/langchain/chains/base.py", line 304, in call self._call(inputs, run_manager=run_manager) File "/usr/local/lib/python3.8/dist-packages/langchain/chains/moderation.py", line 93, in _call results = self.client.create(text) File "/usr/local/lib/python3.8/dist-packages/openai/_utils/_proxy.py", line 22, in getattr return getattr(self.get_proxied(), attr) File "/usr/local/lib/python3.8/dist-packages/openai/_utils/_proxy.py", line 43, in get_proxied return self.load() File "/usr/local/lib/python3.8/dist-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.Moderation, 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

jacobmarks commented 9 months ago

Hey @gurucharansrinivas , sorry you ran into this issue!

When OpenAI released the 1.0.0 version of their Python library, they made some breaking changes to the API. For the time being, we have pinned the OpenAI version in our requirements.txt file here. It should work if you use a compatible version :)