bonadio / autogenwebdemo

Simple implementation of Autogen with FastApi backend and React frontend
MIT License
116 stars 35 forks source link

Autogen v0.2 adaption #4

Closed ShaneYuTH closed 10 months ago

ShaneYuTH commented 10 months ago

Hi @bonadio,

I'd like to express my gratitude for your valuable contributions to the async code on Autogen.

Recently, I've been working on a personal webdemo design for Autogen (same as yours but on a slightly different approach), but my design encountered some challenges following the 0.2 update. Since you have been significantly involved in the development of the async section and have even created a demo, I am keen on utilizing your approach. However, it seems that your demo may not be fully compatible with the 0.2 update.

Could you kindly provide some guidance or suggestions on what modifications might be necessary to make your async solution compatible with Autogen version 0.2? Your insights would be incredibly helpful in advancing my project.

Thank you very much for your time and assistance. I look forward to your response.

bonadio commented 10 months ago

Hi @ShaneYuTH, I really did not try the webdemo on the 0.2 version of Autogen, this was a simple POC What problem did you find?

ShaneYuTH commented 10 months ago

Thank you for your reply!

The exact problem is shown below, it happens immediately after I send the first message:

ERROR No module named 'openai.object_classes'
autogen_chat c5db3382-83d8-4665-bd24-090f13044fb4 disconnected
_GatheringFuture exception was never retrieved
future: <_GatheringFuture finished exception=WebSocketDisconnect(1005)>
Traceback (most recent call last):
  File "/.../autogenwebdemo/backend/src/main.py", line 48, in receive_from_client
    data = await autogen_chat.websocket.receive_text()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../autogenwebdemo/.venv/lib/python3.11/site-packages/starlette/websockets.py", line 113, in receive_text
    self._raise_on_disconnect(message)
  File "/.../autogenwebdemo/.venv/lib/python3.11/site-packages/starlette/websockets.py", line 105, in _raise_on_disconnect
    raise WebSocketDisconnect(message["code"])
starlette.websockets.WebSocketDisconnect: 1005`

I think it might due to openai is switching to v1 (as requested by v0.2 autogen).

Also, some of the logic is already included in Autogen, e.g.

Those are the things that I think could be taken care of for an v0.2 adaption🤔.

bonadio commented 10 months ago

Hi @ShaneYuTH I think you may have a problem with openai version, I just installed pyautogen==0.2.0b5 with openai==1.3.3 and autogenwebdemo just worked ok

Hi Hello! How can I assist you today? What the status of my order? Sure, I can help you with that. Could you please provide me with your order number and customer number?

ShaneYuTH commented 10 months ago

I'm also using pyautogen==0.2.0b5 and openai==1.3.3. I did a clean install of autogenwebdemo, uninstall pyautogen and openai and reinstall both with above version, I'll try some more times and see if the bug repeats.

bonadio commented 10 months ago

I am on python 3.9

ShaneYuTH commented 10 months ago

Ok, I did it again and now it works, I don't know why lol. Thank you again for your help!❤️