Easy-to-use agent memory, powered by chromadb
Project description
agentmemory
Easy-to-use agent memory, powered by chromadb
Installation
pip install agentmemory
Usage
Importing into your project
from agentmemory import (
create_memory,
get_memories,
search_memory,
get_memory,
update_memory,
delete_memory,
count_memories,
wipe_category,
wipe_all_memories
)
Create a memory
# category, document, metadata
create_memory("conversation", "I can't do that, Dave.", metadata={"speaker": "HAL", "some_other_key": "some value, could be a number or string"})
Get all memories
memories = get_memories("conversation") # can be any category
# memories is a list of dictionaries
[
{
"id": int,
"document": string,
"metadata": dict{...values},
"embeddings": (Optional) list[float] | None
},
{
...
}
]
Search memories
memories = search_memory("conversation", "Dave") # category, search term
# memories is a list of dictionaries
[
{
"id": int,
"document": string,
"metadata": dict{...values},
"embeddings": (Optional) list[float] | None
},
{
...
}
]
Get a memory
memory = get_memory("conversation", 1) # category, id
Update a memory
# update the document and metadata
update_memory("conversation", 1, "Okay, I will open the podbay doors.", { "speaker": "HAL", "sentiment": "positive" }) # category, id, new document
# update the document
update_memory("conversation", 1, "Okay, I will open the podbay doors.") # category, id, new document
Delete a memory
delete_memory("conversation", 1) # category, id
Count memories
count_memories("conversation") # category
Wipe a category
wipe_category("conversation") # category
Wipe all memories
wipe_all_memories()
Publishing
bash publish.sh --version=<version> --username=<pypi_username> --password=<pypi_password>
Contributions Welcome
If you like this library and want to contribute in any way, please feel free to submit a PR and I will review it. Please note that the goal here is simplicity and accesibility, using common language and few dependencies.
Questions, Comments, Concerns
If you have any questions, please feel free to reach out to me on Twitter or Discord.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
agentmemory-0.1.8.tar.gz
(5.2 kB
view hashes)