Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

black patch on outstanding files that were causing workflow fails on PRs (#193)

Charles Packer06871cc29809
diff --git a/memgpt/autogen/examples/agent_autoreply.py b/memgpt/autogen/examples/agent_autoreply.py
index e4cf9cc0d..d3b4fce2f 100644
--- a/memgpt/autogen/examples/agent_autoreply.py
+++ b/memgpt/autogen/examples/agent_autoreply.py
@@ -34,7 +34,7 @@ user_proxy = autogen.UserProxyAgent(
code_execution_config={"last_n_messages": 2, "work_dir": "groupchat"},
human_input_mode="TERMINATE", # needed?
default_auto_reply="You are going to figure all out by your own. "
- "Work by yourself, the user won't reply until you output `TERMINATE` to end the conversation.",
+ "Work by yourself, the user won't reply until you output `TERMINATE` to end the conversation.",
)
if not USE_MEMGPT:
@@ -43,7 +43,7 @@ if not USE_MEMGPT:
name="Coder",
llm_config=llm_config,
system_message=f"I am a 10x engineer, trained in Python. I was the first engineer at Uber "
- f"(which I make sure to tell everyone I work with).",
+ f"(which I make sure to tell everyone I work with).",
human_input_mode="TERMINATE",
)
@@ -54,13 +54,12 @@ else:
"MemGPT_coder",
llm_config=llm_config,
system_message=f"I am a 10x engineer, trained in Python. I was the first engineer at Uber "
- f"(which I make sure to tell everyone I work with).",
+ f"(which I make sure to tell everyone I work with).",
human_input_mode="TERMINATE",
)
# Begin the group chat with a message from the user
user_proxy.initiate_chat(
coder,
- message="I want to design an app to make me one million dollars in one month. "
- "Tell me all the details, then try out every steps.",
+ message="I want to design an app to make me one million dollars in one month. " "Tell me all the details, then try out every steps.",
)
diff --git a/memgpt/autogen/examples/agent_groupchat.py b/memgpt/autogen/examples/agent_groupchat.py
index d6339baab..238d3e876 100644
--- a/memgpt/autogen/examples/agent_groupchat.py
+++ b/memgpt/autogen/examples/agent_groupchat.py
@@ -58,9 +58,9 @@ else:
coder = create_autogen_memgpt_agent(
"MemGPT_coder",
persona_description="I am a 10x engineer, trained in Python. I was the first engineer at Uber "
- "(which I make sure to tell everyone I work with).",
+ "(which I make sure to tell everyone I work with).",
user_description=f"You are participating in a group chat with a user ({user_proxy.name}) "
- f"and a product manager ({pm.name}).",
+ f"and a product manager ({pm.name}).",
# extra options
# interface_kwargs={"debug": True},
)
@@ -69,9 +69,9 @@ else:
"MemGPT_coder",
llm_config=llm_config,
system_message=f"I am a 10x engineer, trained in Python. I was the first engineer at Uber "
- f"(which I make sure to tell everyone I work with).\n"
- f"You are participating in a group chat with a user ({user_proxy.name}) "
- f"and a product manager ({pm.name}).",
+ f"(which I make sure to tell everyone I work with).\n"
+ f"You are participating in a group chat with a user ({user_proxy.name}) "
+ f"and a product manager ({pm.name}).",
)
# Initialize the group chat between the user and two LLM agents (PM and coder)
@@ -81,6 +81,5 @@ manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config)
# Begin the group chat with a message from the user
user_proxy.initiate_chat(
manager,
- message="I want to design an app to make me one million dollars in one month. "
- "Yes, your heard that right.",
+ message="I want to design an app to make me one million dollars in one month. " "Yes, your heard that right.",
)
diff --git a/memgpt/autogen/memgpt_agent.py b/memgpt/autogen/memgpt_agent.py
index ac9a2cdd9..2909b2972 100644
--- a/memgpt/autogen/memgpt_agent.py
+++ b/memgpt/autogen/memgpt_agent.py
@@ -75,7 +75,7 @@ def create_memgpt_autogen_agent_from_config(
groupchat = GroupChat(
agents=[autogen_memgpt_agent, coop_agent1, coop_agent2],
messages=[],
- max_round=12 if max_consecutive_auto_reply is None else max_consecutive_auto_reply
+ max_round=12 if max_consecutive_auto_reply is None else max_consecutive_auto_reply,
)
manager = GroupChatManager(name=name, groupchat=groupchat, llm_config=llm_config)
return manager
@@ -146,9 +146,7 @@ class MemGPTAgent(ConversableAgent):
self.register_reply([Agent, None], MemGPTAgent._generate_reply_for_user_message)
self.messages_processed_up_to_idx = 0
- self._is_termination_msg = (
- is_termination_msg if is_termination_msg is not None else (lambda x: x == "TERMINATE")
- )
+ self._is_termination_msg = is_termination_msg if is_termination_msg is not None else (lambda x: x == "TERMINATE")
def format_other_agent_message(self, msg):
if "name" in msg:
@@ -220,7 +218,7 @@ class MemGPTAgent(ConversableAgent):
break
# Stop the conversation
- if self._is_termination_msg(new_messages[-1]['content']):
+ if self._is_termination_msg(new_messages[-1]["content"]):
return True, None
# Pass back to AutoGen the pretty-printed calls MemGPT made to the interface
diff --git a/memgpt/config.py b/memgpt/config.py
index 10fb7dd20..cbed48977 100644
--- a/memgpt/config.py
+++ b/memgpt/config.py
@@ -121,7 +121,9 @@ class Config:
).ask_async()
self.archival_storage_index = None
- self.preload_archival = await questionary.confirm("Would you like to preload anything into MemGPT's archival memory?", default=False).ask_async()
+ self.preload_archival = await questionary.confirm(
+ "Would you like to preload anything into MemGPT's archival memory?", default=False
+ ).ask_async()
if self.preload_archival:
self.load_type = await questionary.select(
"What would you like to load?",
diff --git a/memgpt/memory.py b/memgpt/memory.py
index 8b3130c36..df44c5487 100644
--- a/memgpt/memory.py
+++ b/memgpt/memory.py
@@ -685,7 +685,7 @@ class LocalArchivalMemory(ArchivalMemory):
# from pprint import pprint
# pprint(results)
return results, len(results)
-
+
async def a_search(self, query_string, count=None, start=None):
return self.search(query_string, count, start)