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.

Allow conversation search to find agent's own messages (#2474)

Daniel Fitzick50f038c6fb1c
diff --git a/letta/functions/function_sets/base.py b/letta/functions/function_sets/base.py
index 89521c8c8..022e91148 100644
--- a/letta/functions/function_sets/base.py
+++ b/letta/functions/function_sets/base.py
@@ -45,7 +45,7 @@ def conversation_search(self: "Agent", query: str, page: Optional[int] = 0) -> O
count = RETRIEVAL_QUERY_DEFAULT_PAGE_SIZE
# TODO: add paging by page number. currently cursor only works with strings.
# original: start=page * count
- messages = self.message_manager.list_user_messages_for_agent(
+ messages = self.message_manager.list_messages_for_agent(
agent_id=self.agent_state.id,
actor=self.user,
query_text=query,
diff --git a/tests/test_base_functions.py b/tests/test_base_functions.py
index 037eda2f4..4c60ab173 100644
--- a/tests/test_base_functions.py
+++ b/tests/test_base_functions.py
@@ -86,13 +86,14 @@ def test_archival(agent_obj):
pass
-def test_recall(client, agent_obj):
+def test_recall_self(client, agent_obj):
# keyword
keyword = "banana"
+ keyword_backwards = "".join(reversed(keyword))
# Send messages to agent
client.send_message(agent_id=agent_obj.agent_state.id, role="user", message="hello")
- client.send_message(agent_id=agent_obj.agent_state.id, role="user", message=keyword)
+ client.send_message(agent_id=agent_obj.agent_state.id, role="user", message="what word is '{}' backwards?".format(keyword_backwards))
client.send_message(agent_id=agent_obj.agent_state.id, role="user", message="tell me a fun fact")
# Conversation search