--- 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)