camel icon indicating copy to clipboard operation
camel copied to clipboard

Memory chat

Open X-TRON404 opened this issue 9 months ago • 2 comments

Description

  • Adds an agent_id to every memory record.
  • Updates ChatHistoryBlock to retrieve only the memories associated with the specified agent.
  • Creates this interface for ChatAgent to save, load and clear memories:
agent = ChatAgent(`system_message`="you are a helpful assistant", agent_id="001") # The agent is could be generated randomly is not specified.
agent.save_memory(path: str) -> save `AgentMemory` with `agent_id` presisitently
agent.load_memory(memory: AgentMemory)
agent.load_memory_from_path(path: str)
agent.clear_memory()
  • Adds an option to load agent specific memories from all subclasses of BaseKeyValueStorage and all subclasses of BaseVectorStorage
  • Fixes #1708
  • Fixes some features requested in #1588

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • [x] I have read the CONTRIBUTION guide (required)
  • [x] I have linked this PR to an issue using the Development section on the right sidebar or by adding Fixes #issue-number in the PR description (required)
  • [x] I have checked if any dependencies need to be added or updated in pyproject.toml and poetry.lock
  • [x] I have updated the tests accordingly (required for a bug fix or a new feature)
  • [ ] I have updated the documentation if needed:
  • [ ] I have added examples if this is a new feature

If you are unsure about any of these, don't hesitate to ask. We are here to help!

X-TRON404 avatar Mar 06 '25 13:03 X-TRON404

Can you also add some examples as well?

lightaime avatar Mar 06 '25 13:03 lightaime

Can you also add some examples as well?

Added under camel/examples/memories/agent_memory_test.py

X-TRON404 avatar Mar 06 '25 14:03 X-TRON404