You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm experiencing issues while integrating Chainlit with OpenAI's AutoGen framework for a multi-agent chatbot. The main problems revolve around asynchronous function handling and thread management.
Run the following code using chainlit run app_frontend.py.
Input a message like "Hi, I am having exam stress" in the chatbot.
Observe the errors and behavior.
See the app_frontend.py code
Error Messages:
First Error:
RuntimeWarning: coroutine 'ChainlitAssistantAgent.send' was never awaited
Occurs when the send method in ChainlitAssistantAgent is asynchronous but expected to be synchronous by the autogen library.
Second Error:
TypeError: object dict can't be used in 'await' expression in line 195:
await cl.make_async(initiate_chat)()
Indicates that a non-awaitable object is being awaited.
Third Error:
KeyError: 'run_in_thread'
Occurs when trying to use cl.run_in_thread, which doesn't exist in Chainlit.
Attempts to Resolve:
Changed the send methods in custom agent classes to be synchronous and used cl.run_sync to handle asynchronous Chainlit functions.
Replaced cl.make_async with asyncio.to_thread in the on_message function to run the synchronous user_proxy.initiate_chat method without blocking the event loop.
Issues Remaining:
Even after making these changes, I'm still experiencing errors related to the asynchronous handling of functions and thread management.
The chatbot works for the first conversation but fails or produces errors in subsequent interactions.
#Request:
I'm seeking assistance to:
Identify the root cause of these issues.
Provide guidance on properly integrating Chainlit with the AutoGen framework, especially regarding asynchronous function handling and thread management.
Ensure compatibility between Chainlit and AutoGen for multi-agent chatbots.
Additional Information:
The prompts.yaml file contains the necessary prompts for each agent.
The OAI_CONFIG_LIST environment variable is correctly set and accessible.
I'm using Python 3.10 and have the latest versions of Chainlit and AutoGen installed.
Thankks for your help!
The text was updated successfully, but these errors were encountered:
I'm experiencing issues while integrating Chainlit with OpenAI's AutoGen framework for a multi-agent chatbot. The main problems revolve around asynchronous function handling and thread management.
Environment:
Python Version: Python 3.10
Operating System: macOS Monterey
Steps to Reproduce:
Run the following code using chainlit run app_frontend.py.
Input a message like "Hi, I am having exam stress" in the chatbot.
Observe the errors and behavior.
See the app_frontend.py code
Error Messages:
First Error:
RuntimeWarning: coroutine 'ChainlitAssistantAgent.send' was never awaited
Occurs when the send method in ChainlitAssistantAgent is asynchronous but expected to be synchronous by the autogen library.
Second Error:
TypeError: object dict can't be used in 'await' expression in line 195:
await cl.make_async(initiate_chat)()
Indicates that a non-awaitable object is being awaited.
Third Error:
KeyError: 'run_in_thread'
Occurs when trying to use cl.run_in_thread, which doesn't exist in Chainlit.
Attempts to Resolve:
Changed the send methods in custom agent classes to be synchronous and used cl.run_sync to handle asynchronous Chainlit functions.
Replaced cl.make_async with asyncio.to_thread in the on_message function to run the synchronous user_proxy.initiate_chat method without blocking the event loop.
Issues Remaining:
Even after making these changes, I'm still experiencing errors related to the asynchronous handling of functions and thread management.
The chatbot works for the first conversation but fails or produces errors in subsequent interactions.
#Request:
I'm seeking assistance to:
Identify the root cause of these issues.
Provide guidance on properly integrating Chainlit with the AutoGen framework, especially regarding asynchronous function handling and thread management.
Ensure compatibility between Chainlit and AutoGen for multi-agent chatbots.
Additional Information:
The prompts.yaml file contains the necessary prompts for each agent.
The OAI_CONFIG_LIST environment variable is correctly set and accessible.
I'm using Python 3.10 and have the latest versions of Chainlit and AutoGen installed.
Thankks for your help!
The text was updated successfully, but these errors were encountered: