Thread memory for AI agents
Project description
threadmem
Chat thread memory for AI agents
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Threadmem is a simple tool that helps manage chat conversations with language models.
Backend
Installation
pip install threadmem
Usage
Role Threads
Role based threads are useful for managing openai-style chat schemas.
from threadmem import RoleThread
# Create a thread storing it in a local sqlite db
thread = RoleThread(owner_id="dolores@agentsea.ai")
# Post messages
thread.post("user", "Hello, Thread!")
thread.post("assistant", "How can I help?")
thread.post("user", "Whats this image?", images=["data:image/jpeg;base64,..."])
# Output in openai chat schema format
print(thread.to_oai())
# Find a thread
threads = RoleThread.find(owner_id="dolores@agentsea.ai")
# Delete a thread
threads[0].delete()
Backends
Thread and prompt storage can be backed by:
- Sqlite
- Postgresql
Sqlite will be used by default. To use postgres simply configure the env vars:
DB_TYPE=postgres
DB_NAME=threads
DB_HOST=localhost
DB_USER=postgres
DB_PASS=abc123
Develop
To test
make test
To publish
make publish
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
threadmem-0.2.28.tar.gz
(15.2 kB
view hashes)
Built Distribution
threadmem-0.2.28-py3-none-any.whl
(18.0 kB
view hashes)
Close
Hashes for threadmem-0.2.28-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a76b6769c53967576c8c0d0526974b3bdf6913db3787f57e529fe18629bd039 |
|
MD5 | 67c2d3f099d9a793b28ddcc8a8023bc7 |
|
BLAKE2b-256 | 7b35820f13350f682fc29ec6e71b60cc80d226fc8abe3d74991ceb62c72d1565 |