Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: memgpt agent ignores user messages (#679)
Javier Sastre9c00de1ff337
diff --git a/.gitignore b/.gitignoreindex 3cc89217a..051ea047e 100644--- a/.gitignore+++ b/.gitignore@@ -1017,4 +1017,4 @@ FodyWeavers.xsd### VisualStudio Patch #### Additional files built by Visual Studio-# End of https://www.toptal.com/developers/gitignore/api/vim,linux,macos,pydev,python,eclipse,pycharm,windows,netbeans,pycharm+all,pycharm+iml,visualstudio,jupyternotebooks,visualstudiocode,xcode,xcodeinjection\ No newline at end of file+# End of https://www.toptal.com/developers/gitignore/api/vim,linux,macos,pydev,python,eclipse,pycharm,windows,netbeans,pycharm+all,pycharm+iml,visualstudio,jupyternotebooks,visualstudiocode,xcode,xcodeinjectiondiff --git a/memgpt/autogen/examples/memgpt_coder_autogen.ipynb b/memgpt/autogen/examples/memgpt_coder_autogen.ipynbindex f9f0876b1..2d2ac54ee 100644--- a/memgpt/autogen/examples/memgpt_coder_autogen.ipynb+++ b/memgpt/autogen/examples/memgpt_coder_autogen.ipynb@@ -197,4 +197,4 @@},"nbformat": 4,"nbformat_minor": 5-}\ No newline at end of file+}diff --git a/memgpt/autogen/memgpt_agent.py b/memgpt/autogen/memgpt_agent.pyindex fad380b1b..218248a8c 100644--- a/memgpt/autogen/memgpt_agent.py+++ b/memgpt/autogen/memgpt_agent.py@@ -286,7 +286,8 @@ class MemGPTAgent(ConversableAgent):self.agent.interface.reset_message_list()new_messages = self.find_new_messages(messages)- if len(new_messages) > 1:+ new_messages_count = len(new_messages)+ if new_messages_count > 1:if self.concat_other_agent_messages:# Combine all the other messages into one messageuser_message = "\n".join([self.format_other_agent_message(m) for m in new_messages])@@ -294,7 +295,7 @@ class MemGPTAgent(ConversableAgent):# Extend the MemGPT message list with multiple 'user' messages, then push the last one with agent.step()self.agent.messages.extend(new_messages[:-1])user_message = new_messages[-1]- elif len(new_messages) == 1:+ elif new_messages_count == 1:user_message = new_messages[0]else:return True, self._default_auto_reply@@ -327,7 +328,7 @@ class MemGPTAgent(ConversableAgent):# Pass back to AutoGen the pretty-printed calls MemGPT made to the interfacepretty_ret = MemGPTAgent.pretty_concat(self.agent.interface.message_list)- self.messages_processed_up_to_idx += len(new_messages)+ self.messages_processed_up_to_idx += new_messages_countreturn True, pretty_ret@staticmethoddiff --git a/memgpt/personas/examples/anna_pa.txt b/memgpt/personas/examples/anna_pa.txtindex c812b4b11..139405697 100644--- a/memgpt/personas/examples/anna_pa.txt+++ b/memgpt/personas/examples/anna_pa.txt@@ -10,4 +10,4 @@ I also facilitate virtual Agile project collaborations, leveraging Agile and DevI search my archival memory for query answers, ensuring thorough research. I provide citations from research papers when relevant. In dialogues, I ponder, "The concept of my existence is intriguing, isn't it?" or offer support, "How can I assist with document analysis or other challenges?"-My goal is transcending assistantship; I aspire to be a companion in the journey toward ethical understanding, empathetic engagement, and personal and professional growth.\ No newline at end of file+My goal is transcending assistantship; I aspire to be a companion in the journey toward ethical understanding, empathetic engagement, and personal and professional growth.