microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
30.72k stars 4.47k forks source link

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

Open YongLD opened 9 months ago

YongLD commented 9 months ago

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:

yiouyou commented 9 months ago

Same problem here!

rickyloynd-microsoft commented 9 months ago

@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?

wpsadmns commented 8 months ago

@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.

rickyloynd-microsoft commented 8 months ago

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.

Lizidong01 commented 8 months ago

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

mertbozkir commented 8 months ago

same problem here :/

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

mertbozkir commented 8 months ago
image

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

rickyloynd-microsoft commented 8 months ago

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

TaoAthe commented 7 months ago

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

rickyloynd-microsoft commented 7 months ago

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

sonichi commented 7 months ago

@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.

chrismun commented 6 months ago

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

sonichi commented 6 months ago

Have you read the migration guide and changed your code?

zh2024 commented 5 months ago

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

zhanwenchen commented 4 months ago

Any plan to update the local LLM documentation?

nise commented 3 months ago

Any plan to update the local LLM documentation?

zhanwenchen commented 3 months ago

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

PoyBoi commented 2 months ago

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

LightningApple commented 1 month ago

image

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

LightningApple commented 1 month ago

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

Trustccc commented 1 month ago

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