mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
checking crew before using memory
This commit is contained in:
@@ -53,7 +53,8 @@ class CrewAgentExecutor(AgentExecutor):
|
||||
|
||||
def _create_short_term_memory(self, output) -> None:
|
||||
if (
|
||||
self.crew_agent.memory
|
||||
self.crew
|
||||
and self.crew_agent.memory
|
||||
and "Action: Delegate work to co-worker" not in output.log
|
||||
):
|
||||
memory = ShortTermMemoryItem(
|
||||
@@ -66,7 +67,7 @@ class CrewAgentExecutor(AgentExecutor):
|
||||
self.crew._short_term_memory.save(memory)
|
||||
|
||||
def _create_long_term_memory(self, output) -> None:
|
||||
if self.crew_agent.memory:
|
||||
if self.crew and self.crew_agent.memory:
|
||||
ltm_agent = TaskEvaluator(self.crew_agent)
|
||||
evaluation = ltm_agent.evaluate(self.task, output.log)
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from langchain_core.callbacks import BaseCallbackHandler
|
||||
@@ -158,10 +155,6 @@ class Crew(BaseModel):
|
||||
def create_crew_memory(self) -> "Crew":
|
||||
"""Set private attributes."""
|
||||
if self.memory:
|
||||
storage_dir = Path(".db")
|
||||
storage_dir.mkdir(exist_ok=True)
|
||||
if sys.platform.startswith("win"):
|
||||
subprocess.call(["attrib", "+H", str(storage_dir)])
|
||||
self._long_term_memory = LongTermMemory()
|
||||
self._short_term_memory = ShortTermMemory(embedder_config=self.embedder)
|
||||
self._entity_memory = EntityMemory(embedder_config=self.embedder)
|
||||
|
||||
Reference in New Issue
Block a user