mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 16:18:30 +00:00
Minor Changes
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user