autogen icon indicating copy to clipboard operation
autogen copied to clipboard

[Bug]: AssertionError: (Deprecated) The autogen.Completion class requires openai<1 and diskcache.

Open YongLD opened this issue 1 year ago • 21 comments

Describe the bug

Code following:

from autogen import oai
response = oai.Completion.create(
 config_list=[
     {
         "model": "chatglm2-6b",
         "api_base": "http://0.0.0.0:8000/v1",
         "api_type": "open_ai",
         "api_key": "NULL", # just a placeholder
     }
 ],
 prompt="Hi",
)
print(response)

Got AssertionError: (Deprecated) The autogen.Completion class requires openai<1 and diskcache.

I found this in autogen/oai/completion.py:

assert openai.__version__ < "1"

Why??? Isn't AutoGen supposed to require openai > 1?

Steps to reproduce

No response

Expected Behavior

No response

Screenshots and logs

No response

Additional Information

autoGen version: pyautogen==0.2.2 Operating System: ubuntu18.04 Python Version: conda env python==3.10 Any other relevant information:

  • openai == 1.3.8
  • │diskcache == 5.6.3

YongLD avatar Dec 12 '23 06:12 YongLD

Same problem here!

yiouyou avatar Dec 12 '23 08:12 yiouyou

@YongLD @yiouyou It's correct that autogen (pyautogen==0.2.2) now requires openai>1, which no longer supports the old Completion API. The autogen.Completion class, though deprecated, is still included in the repo (at least for now) for users who need it, but they must manually install an older version of openai to use it.

How could we improve the error message to make this clearer?

rickyloynd-microsoft avatar Dec 12 '23 14:12 rickyloynd-microsoft

@YongLD @yiouyou It's correct that autogen (pyautogen==0.2.2) now requires openai>1, which no longer supports the old Completion API. The autogen.Completion class, though deprecated, is still included in the repo (at least for now) for users who need it, but they must manually install an older version of openai to use it.

How could we improve the error message to make this clearer?

You should consider how to fix it, rather than asking us to downgrade the version of OpenAI.

wpsadmns avatar Dec 18 '23 11:12 wpsadmns

To be more clear, if your app requires openai's old completion API, then your only option is to downgrade to the older openai version. If you find a better option, please reopen this issue.

rickyloynd-microsoft avatar Dec 18 '23 14:12 rickyloynd-microsoft

I have the same problem, is this problem solved now?

Lizidong01 avatar Dec 29 '23 03:12 Lizidong01

same problem here :/

I'm gonna try to create another virtual environment. But, I think we gotta solve this problem! 🥲

mertbozkir avatar Jan 02 '24 15:01 mertbozkir

image

even though my version is 0.28.1 which is latest before 1.0, I'm getting the same error!

mertbozkir avatar Jan 02 '24 15:01 mertbozkir

Reopening the issue to understand what is needed here. @YongLD @yiouyou @wpsadmns @Lizidong01 @mertbozkir : What version of pyautogen are you each running?

rickyloynd-microsoft avatar Jan 02 '24 17:01 rickyloynd-microsoft

Where is the solution to this problem? When I downgrade my openai - 0.28.1 pyautogen complains that it needs a > openai.

TaoAthe avatar Jan 21 '24 00:01 TaoAthe

What is your version of pyautogen? pyautogen>=0.2.2 now requires openai>1. What exactly is the error message?

rickyloynd-microsoft avatar Jan 21 '24 00:01 rickyloynd-microsoft

@YongLD @TaoAthe please read the migration guide: https://microsoft.github.io/autogen/docs/Installation#migration-guide-to-v02. Your old code won't work with the new version of openai because openai makes a breaking change.

sonichi avatar Jan 21 '24 04:01 sonichi

Im still getting this error. When I upgrade pyautogen and openai, I get this: AssertionError: (Deprecated) The autogen.Completion class requires openai<1 and diskcache.

When I downgrade openai to 0.28.1, I get this:

autogen/logger/base_logger.py", line 8, in from openai import OpenAI, AzureOpenAI ImportError: cannot import name 'OpenAI' from 'openai' (.../myenv/lib/python3.10/site-packages/openai/init.py)

When I also downgrade pyautogen to 0.1, I get this error (I double checked, I have disk space where im running...) : myenv/lib/python3.10/site-packages/diskcache/core.py", line 2431, in reset ((old_value,),) = sql( sqlite3.OperationalError: disk I/O error

chrismun avatar Feb 19 '24 22:02 chrismun

Have you read the migration guide and changed your code?

sonichi avatar Feb 19 '24 23:02 sonichi

same here. I think the document hasn't been updated Interact with model using oai.Completion (requires openai<1)

zh2024 avatar Mar 26 '24 03:03 zh2024

Any plan to update the local LLM documentation?

zhanwenchen avatar Apr 25 '24 02:04 zhanwenchen

Any plan to update the local LLM documentation?

nise avatar Jun 04 '24 20:06 nise

Meanwhile, @nise you could follow my tutorial: https://medium.com/@zhanwenchen/local-llm-agents-autogen-and-llama-3-ff6588857b76

zhanwenchen avatar Jun 05 '24 05:06 zhanwenchen

@zhanwenchen you my friend, are a messenger of god, tysm

PoyBoi avatar Jul 11 '24 08:07 PoyBoi

image

https://microsoft.github.io/autogen/docs/Use-Cases/enhanced_inference/#api-unification image

LightningApple avatar Aug 08 '24 10:08 LightningApple

我用这个可以调通azure,和本地部署的openai接口

LightningApple avatar Aug 08 '24 10:08 LightningApple

我用这个可以调通azure,和本地部署的openai接口 太牛了家人!

Trustccc avatar Aug 08 '24 15:08 Trustccc