MemGPT-AutoGEN-LLM icon indicating copy to clipboard operation
MemGPT-AutoGEN-LLM copied to clipboard

TypeError: cannot unpack non-iterable coroutine object

Open JaRail opened this issue 2 years ago • 3 comments

Just tried installing and running this against a local LLM. Looks like maybe MemGPT made a breaking change?

(venv) D:\ai\MemGPT-AutoGEN-LLM>py app.py

MemGPT Agent at work

User_proxy (to MemGPT_coder):

Write a Function to print Numbers 1 to 10

--------------------------------------------------------------------------------
D:\ai\MemGPT-AutoGEN-LLM\venv\Lib\site-packages\memgpt\autogen\memgpt_agent.py:212: RuntimeWarning: coroutine 'AgentAsync.step' was never awaited
  (
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
  File "D:\ai\MemGPT-AutoGEN-LLM\app.py", line 76, in <module>
    user_proxy.initiate_chat(
  File "D:\ai\MemGPT-AutoGEN-LLM\venv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 531, in initiate_chat
    self.send(self.generate_init_message(**context), recipient, silent=silent)
  File "D:\ai\MemGPT-AutoGEN-LLM\venv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 334, in send
    recipient.receive(message, self, request_reply, silent)
  File "D:\ai\MemGPT-AutoGEN-LLM\venv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 462, in receive
    reply = self.generate_reply(messages=self.chat_messages[sender], sender=sender)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ai\MemGPT-AutoGEN-LLM\venv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 781, in generate_reply
    final, reply = reply_func(self, messages=messages, sender=sender, config=reply_func_tuple["config"])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ai\MemGPT-AutoGEN-LLM\venv\Lib\site-packages\memgpt\autogen\memgpt_agent.py", line 212, in _generate_reply_for_user_message
    (
TypeError: cannot unpack non-iterable coroutine object

JaRail avatar Nov 06 '23 01:11 JaRail

i get the same but haven't dug deeper. windows.

tidymonkey81 avatar Nov 06 '23 03:11 tidymonkey81

i get the same but haven't dug deeper. windows.

Here's the fix. At least if you're using:

pyautogen==0.1.14
pymemgpt==0.1.17

Problem: These code bases move so quickly that when he publishes the video, the latest versions have changed and introduced bugs.

Solution:

Use the same version that @PromptEngineer48 used. But since he didn't publish versions. I have a code change that will fix it.

In your virtual env: Go to : /lib/python3.11/site-packages/memgpt/autogen/memgpt_agent.py

at around line 185:

def _generate_reply_for_user_message(

Change to:

async def _generate_reply_for_user_message(

This should work.

@PromptEngineer48 could you please start including a frozen requirements.txt file so that we can use the exact some libs as you? Love your stuff but this would help a TON!

pathToYourVirtualEnv/bin/python -m pip freeze > requirements.txt

GeoffMillerAZ avatar Nov 06 '23 19:11 GeoffMillerAZ

Point well taken!

PromptEngineer48 avatar Nov 06 '23 19:11 PromptEngineer48