Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions mirix/agent/agent_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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()

Expand Down
18 changes: 14 additions & 4 deletions mirix/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 8 additions & 2 deletions mirix/functions/function_sets/memory_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,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
Expand Down Expand Up @@ -474,7 +477,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
Expand Down