mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
Pr branch (#2312)
* Adjust checking for callable crew object. Changes back to how it was being done before. Fixes #2307 * Fix specific memory reset errors. When not initiated, the function should raise the "memory system is not initialized" RuntimeError. * Remove print statement * Fixes test case --------- Co-authored-by: Carlos Souza <carloshrsouza@gmail.com>
This commit is contained in:
@@ -273,11 +273,9 @@ def get_crew(crew_path: str = "crew.py", require: bool = False) -> Crew | None:
|
|||||||
for attr_name in dir(module):
|
for attr_name in dir(module):
|
||||||
attr = getattr(module, attr_name)
|
attr = getattr(module, attr_name)
|
||||||
try:
|
try:
|
||||||
if isinstance(attr, Crew) and hasattr(attr, "kickoff"):
|
if callable(attr) and hasattr(attr, "crew"):
|
||||||
print(
|
crew_instance = attr().crew()
|
||||||
f"Found valid crew object in attribute '{attr_name}' at {crew_os_path}."
|
return crew_instance
|
||||||
)
|
|
||||||
return attr
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error processing attribute {attr_name}: {e}")
|
print(f"Error processing attribute {attr_name}: {e}")
|
||||||
|
|||||||
@@ -1399,12 +1399,12 @@ class Crew(BaseModel):
|
|||||||
RuntimeError: If the specified memory system fails to reset
|
RuntimeError: If the specified memory system fails to reset
|
||||||
"""
|
"""
|
||||||
reset_functions = {
|
reset_functions = {
|
||||||
"long": (self._long_term_memory, "long term"),
|
"long": (getattr(self, "_long_term_memory", None), "long term"),
|
||||||
"short": (self._short_term_memory, "short term"),
|
"short": (getattr(self, "_short_term_memory", None), "short term"),
|
||||||
"entity": (self._entity_memory, "entity"),
|
"entity": (getattr(self, "_entity_memory", None), "entity"),
|
||||||
"knowledge": (self.knowledge, "knowledge"),
|
"knowledge": (getattr(self, "knowledge", None), "knowledge"),
|
||||||
"kickoff_outputs": (self._task_output_handler, "task output"),
|
"kickoff_outputs": (getattr(self, "_task_output_handler", None), "task output"),
|
||||||
"external": (self._external_memory, "external"),
|
"external": (getattr(self, "_external_memory", None), "external"),
|
||||||
}
|
}
|
||||||
|
|
||||||
memory_system, name = reset_functions[memory_type]
|
memory_system, name = reset_functions[memory_type]
|
||||||
|
|||||||
Reference in New Issue
Block a user