Minor Changes

This commit is contained in:
Vidit-Ostwal
2025-03-28 22:08:15 +05:30
parent 625748e462
commit 08a6a82071
5 changed files with 270 additions and 22 deletions

View File

@@ -290,24 +290,25 @@ class Crew(BaseModel):
else EntityMemory(crew=self, embedder_config=self.embedder)
)
if (
self.memory_config and "user_memory" in self.memory_config
self.memory_config and "user_memory" in self.memory_config and self.memory_config.get('provider') == 'mem0'
): # Check for user_memory in config
user_memory_config = self.memory_config["user_memory"]
if isinstance(
user_memory_config, UserMemory
): # Check if it is already an instance
self._user_memory = user_memory_config
elif isinstance(
user_memory_config, dict
): # Check if it's a configuration dict
self._user_memory = UserMemory(
crew=self, **user_memory_config
) # Initialize with config
crew=self
)
else:
raise TypeError(
"user_memory must be a UserMemory instance or a configuration dictionary"
"user_memory must be a configuration dictionary"
)
else:
self._logger.log(
"warning",
"User memory initialization failed. For setup instructions, please refer to the memory documentation: https://docs.crewai.com/concepts/memory#integrating-mem0-for-enhanced-user-memory",
color="yellow"
)
self._user_memory = None # No user memory if not in config
return self