From c50eee3e6574fb571ed03dd415bb34b4d00dae07 Mon Sep 17 00:00:00 2001 From: Ren Koya Date: Sun, 3 Aug 2025 00:47:08 +0900 Subject: [PATCH 1/2] fix requirements --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index cd72940..0d8bfd5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,6 @@ composio colorama anthropic httpx_sse -Markdown rapidfuzz rank-bm25 psutil From 79e92ef6d71d7e592ec0d177c13bc08b5ee5d83b Mon Sep 17 00:00:00 2001 From: Ren Koya Date: Mon, 18 Aug 2025 17:15:38 +0900 Subject: [PATCH 2/2] feat: allow create_client to accept user/org IDs and config options --- mirix/agent/agent_wrapper.py | 26 ++++++++++++++----- mirix/client/client.py | 18 ++++++++++--- mirix/functions/function_sets/memory_tools.py | 10 +++++-- 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/mirix/agent/agent_wrapper.py b/mirix/agent/agent_wrapper.py index 57cefc2..df54ca8 100644 --- a/mirix/agent/agent_wrapper.py +++ b/mirix/agent/agent_wrapper.py @@ -95,7 +95,17 @@ def get_image_mime_type(image_path): class AgentWrapper(): - def __init__(self, agent_config_file, load_from=None): + def __init__( + self, + agent_config_file, + load_from=None, + user_id: Optional[str] = None, + org_id: Optional[str] = None, + debug: bool = False, + default_llm_config: Optional[LLMConfig] = None, + default_embedding_config: Optional[EmbeddingConfig] = None, + ): + # If load_from is specified, restore the database first before any agent initialization if load_from is not None: @@ -115,11 +125,13 @@ def __init__(self, agent_config_file, load_from=None): self.logger = logging.getLogger(f"Mirix.AgentWrapper.{self.agent_name}") self.logger.setLevel(logging.INFO) - self.client = create_client() - self.client.set_default_llm_config(LLMConfig.default_config("gpt-4o-mini")) - # self.client.set_default_embedding_config(EmbeddingConfig.default_config("text-embedding-3-small")) - self.client.set_default_embedding_config(EmbeddingConfig.default_config("text-embedding-004")) - + self.client = create_client( + user_id=user_id, + org_id=org_id, + debug=debug, + default_llm_config=default_llm_config or LLMConfig.default_config("gpt-4o-mini"), + default_embedding_config=default_embedding_config or EmbeddingConfig.default_config("text-embedding-004"), + ) # Initialize agent states container self.agent_states = AgentStates() @@ -866,7 +878,7 @@ def clear_old_screenshots(self): else: self.logger.warning("Warning: Cannot delete files from Google Cloud - Gemini client not initialized") - def reflextion_on_memory(self): + def reflexion_on_memory(self): """ Run the reflexion process with comprehensive memory analysis: 1. Call specific agents to remove redundancy in each memory type (episodic, semantic, core, resource, procedural, knowledge vault) diff --git a/mirix/client/client.py b/mirix/client/client.py index f39f5be..5315470 100644 --- a/mirix/client/client.py +++ b/mirix/client/client.py @@ -44,10 +44,20 @@ from mirix.prompts import gpt_persona -def create_client(): - return LocalClient() - - +def create_client( + user_id: Optional[str] = None, + org_id: Optional[str] = None, + debug: bool = False, + default_llm_config: Optional[LLMConfig] = None, + default_embedding_config: Optional[EmbeddingConfig] = None, +): + return LocalClient( + user_id=user_id, + org_id=org_id, + debug=debug, + default_llm_config=default_llm_config, + default_embedding_config=default_embedding_config, + ) class AbstractClient(object): def __init__( self, diff --git a/mirix/functions/function_sets/memory_tools.py b/mirix/functions/function_sets/memory_tools.py index c4e163f..5b60657 100644 --- a/mirix/functions/function_sets/memory_tools.py +++ b/mirix/functions/function_sets/memory_tools.py @@ -400,7 +400,10 @@ def trigger_memory_update_with_instruction(self: "Agent", user_message: object, from mirix import create_client - client = create_client() + client = create_client( + user_id=self.user.id, + org_id=self.user.organization_id + ) agents = client.list_agents() # Validate that user_message is a dictionary @@ -457,7 +460,10 @@ def trigger_memory_update(self: "Agent", user_message: object, memory_types: Lis from mirix import create_client - client = create_client() + client = create_client( + user_id=self.user.id, + org_id=self.user.organization_id + ) agents = client.list_agents() # Validate that user_message is a dictionary