mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
* fix: fix crewai-tools cli command * feat: add crewai train CLI command * feat: add the tests * fix: fix typing hinting issue on code * fix: test.yml * fix: fix test * fix: removed fix since it didnt changed the test
26 lines
931 B
Python
26 lines
931 B
Python
from crewai.memory.entity.entity_memory_item import EntityMemoryItem
|
|
from crewai.memory.memory import Memory
|
|
from crewai.memory.storage.rag_storage import RAGStorage
|
|
|
|
|
|
class EntityMemory(Memory):
|
|
"""
|
|
EntityMemory class for managing structured information about entities
|
|
and their relationships using SQLite storage.
|
|
Inherits from the Memory class.
|
|
"""
|
|
|
|
def __init__(self, crew=None, embedder_config=None):
|
|
storage = RAGStorage(
|
|
type="entities",
|
|
allow_reset=False,
|
|
embedder_config=embedder_config,
|
|
crew=crew,
|
|
)
|
|
super().__init__(storage)
|
|
|
|
def save(self, item: EntityMemoryItem) -> None: # type: ignore # BUG?: Signature of "save" incompatible with supertype "Memory"
|
|
"""Saves an entity item into the SQLite storage."""
|
|
data = f"{item.name}({item.type}): {item.description}"
|
|
super().save(data, item.metadata)
|