Hybrid Memory
This structure explicitly models the human short-term and long-term memories. The short-term memory temporarily buffers recent perceptions, while long-term memory consolidates important information over time.
For example, the short-term memory contains the context information about the agent current situations, while the long-term memory stores the agent past behaviors and thoughts, which can be retrieved according to the current events.
Creating A Hybrid Memory
Method 1: Creating A Hybrid Memory with Default Values
It will use OpenAI Embedding API and ChromaStore as the default values.
import shutil
from dbgpt.agent import HybridMemory, AgentMemory
# Delete old vector store directory(/tmp/tmp_ltm_vector_stor)
shutil.rmtree("/tmp/tmp_ltm_vector_store", ignore_errors=True)
hybrid_memory = HybridMemory.from_chroma(
vstore_name="agent_memory", vstore_path="/tmp/tmp_ltm_vector_store"
)
agent_memory: AgentMemory = AgentMemory(memory=hybrid_memory)