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.

added a new test that makes sure the base functions are working

cpacker1f6af59e9dcb
diff --git a/tests/test_base_functions.py b/tests/test_base_functions.py
new file mode 100644
index 000000000..d2a3f6955
--- /dev/null
+++ b/tests/test_base_functions.py
@@ -0,0 +1,50 @@
+from memgpt import MemGPT
+from memgpt import constants
+import memgpt.functions.function_sets.base as base_functions
+
+from .utils import wipe_config
+
+
+# test_agent_id = "test_agent"
+client = None
+agent_obj = None
+
+
+def create_test_agent():
+ """Create a test agent that we can call functions on"""
+ wipe_config()
+ global client
+ client = MemGPT(quickstart="memgpt_hosted")
+
+ agent_id = client.create_agent(
+ agent_config={
+ # "name": test_agent_id,
+ "persona": constants.DEFAULT_PERSONA,
+ "human": constants.DEFAULT_HUMAN,
+ }
+ )
+
+ global agent_obj
+ agent_obj = client.server._get_or_load_agent(user_id="NULL", agent_id=agent_id)
+
+
+def test_archival():
+ global agent_obj
+ if agent_obj is None:
+ create_test_agent()
+
+ base_functions.archival_memory_insert(agent_obj, "banana")
+
+ base_functions.archival_memory_search(agent_obj, "banana")
+ base_functions.archival_memory_search(agent_obj, "banana", page=0)
+
+
+def test_recall():
+ global agent_obj
+ if agent_obj is None:
+ create_test_agent()
+
+ base_functions.conversation_search(agent_obj, "banana")
+ base_functions.conversation_search(agent_obj, "banana", page=0)
+
+ base_functions.conversation_search_date(agent_obj, start_date="2022-01-01", end_date="2022-01-02")