File size: 4,307 Bytes
750b88d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
--- a/MIRIX/mirix/functions/function_sets/base.py
+++ b/MIRIX/mirix/functions/function_sets/base.py
@@ -1,3 +1,4 @@
+# Modified.
 from typing import Optional
 
 from mirix.agent import Agent, AgentState
@@ -103,6 +104,7 @@
     Returns:
         str: Query result string
     """
+    from mirix.constants import MAX_RETRIEVAL_LIMIT_IN_SYSTEM
 
     if not self.user:
         raise ValueError("Can not search in memory. User is not set")
@@ -143,7 +145,7 @@
             embedded_text=embedded_text_padded if search_method == "embedding" and query else None,
             search_field=search_field if search_field != "null" else "summary",
             search_method=search_method,
-            limit=10,
+            limit=MAX_RETRIEVAL_LIMIT_IN_SYSTEM,
             timezone_str=timezone_str,
         )
         formatted_results_from_episodic = [
@@ -171,7 +173,7 @@
                 search_field if search_field != "null" else ("summary" if search_method == "embedding" else "content")
             ),
             search_method=search_method,
-            limit=10,
+            limit=MAX_RETRIEVAL_LIMIT_IN_SYSTEM,
             timezone_str=timezone_str,
         )
         formatted_results_resource = [
@@ -195,7 +197,7 @@
             embedded_text=embedded_text if search_method == "embedding" and query else None,
             search_field=search_field if search_field != "null" else "summary",
             search_method=search_method,
-            limit=10,
+            limit=MAX_RETRIEVAL_LIMIT_IN_SYSTEM,
             timezone_str=timezone_str,
         )
         formatted_results_procedural = [
@@ -219,7 +221,7 @@
             embedded_text=embedded_text if search_method == "embedding" and query else None,
             search_field=search_field if search_field != "null" else "caption",
             search_method=search_method,
-            limit=10,
+            limit=MAX_RETRIEVAL_LIMIT_IN_SYSTEM,
             timezone_str=timezone_str,
         )
         formatted_results_knowledge_vault = [
@@ -245,7 +247,7 @@
             embedded_text=embedded_text if search_method == "embedding" and query else None,
             search_field=search_field if search_field != "null" else "summary",
             search_method=search_method,
-            limit=10,
+            limit=MAX_RETRIEVAL_LIMIT_IN_SYSTEM,
             timezone_str=timezone_str,
         )
         # title, summary, details, source
--- a/MIRIX/mirix/services/agent_manager.py
+++ b/MIRIX/mirix/services/agent_manager.py
@@ -1,3 +1,4 @@
+# Modified.
 import os
 from datetime import datetime
 from typing import Dict, List, Optional
@@ -1588,7 +1589,7 @@
             actor: The Client performing the operation.
             user_id: The user whose messages to trim. If None, trims all non-system messages.
         """
-        message_ids = await self.get_agent_by_id(agent_id=agent_id, actor=actor).message_ids
+        message_ids = (await self.get_agent_by_id(agent_id=agent_id, actor=actor)).message_ids
         system_message_id = message_ids[0]
         message_ids = message_ids[1:]
 
@@ -1624,7 +1625,7 @@
             actor: The Client performing the operation.
             user_id: The user whose messages to remove. If None, removes all non-system messages.
         """
-        message_ids = await self.get_agent_by_id(agent_id=agent_id, actor=actor).message_ids
+        message_ids = (await self.get_agent_by_id(agent_id=agent_id, actor=actor)).message_ids
         system_message_id = message_ids[0]  # 0 is system message
 
         # Keep system message and only filter out messages belonging to the specified user
@@ -1644,7 +1645,7 @@
         actor: PydanticClient,
         user_id: Optional[str] = None,
     ) -> PydanticAgentState:
-        message_ids = await self.get_agent_by_id(agent_id=agent_id, actor=actor).message_ids
+        message_ids = (await self.get_agent_by_id(agent_id=agent_id, actor=actor)).message_ids
         new_messages = await self.message_manager.create_many_messages(messages, actor=actor, user_id=user_id)
         message_ids = [message_ids[0]] + [m.id for m in new_messages] + message_ids[1:]
         return await self.set_in_context_messages(agent_id=agent_id, message_ids=message_ids, actor=actor)