Merge branch 'main' into bugfix/fix-backtick-in-agent-response

This commit is contained in:
Brandon Hancock (bhancock_ai)
2025-02-18 15:23:40 -05:00
committed by GitHub

View File

@@ -275,12 +275,26 @@ class Crew(BaseModel):
if self.entity_memory if self.entity_memory
else EntityMemory(crew=self, embedder_config=self.embedder) else EntityMemory(crew=self, embedder_config=self.embedder)
) )
if hasattr(self, "memory_config") and self.memory_config is not None: if (
self._user_memory = ( self.memory_config and "user_memory" in self.memory_config
self.user_memory if self.user_memory else UserMemory(crew=self) ): # 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
else:
raise TypeError(
"user_memory must be a UserMemory instance or a configuration dictionary"
)
else: else:
self._user_memory = None self._user_memory = None # No user memory if not in config
return self return self
@model_validator(mode="after") @model_validator(mode="after")
@@ -455,8 +469,6 @@ class Crew(BaseModel):
) )
return self return self
@property @property
def key(self) -> str: def key(self) -> str:
source = [agent.key for agent in self.agents] + [ source = [agent.key for agent in self.agents] + [