Skip to main content

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


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.26.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

threadmem-0.2.26-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file threadmem-0.2.26.tar.gz.

File metadata

  • Download URL: threadmem-0.2.26.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.1 Darwin/22.6.0

File hashes

Hashes for threadmem-0.2.26.tar.gz
Algorithm Hash digest
SHA256 375b08da85a106cd2cae7d948391f261b0659a93997b6cf8068c288b5f9f0955
MD5 6834da934612cd817e1dd712def726a8
BLAKE2b-256 66d9d4962007f207e0430a88de466b01ea012c602a8eb3e2bbd81bc8efebf12b

See more details on using hashes here.

File details

Details for the file threadmem-0.2.26-py3-none-any.whl.

File metadata

  • Download URL: threadmem-0.2.26-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.1 Darwin/22.6.0

File hashes

Hashes for threadmem-0.2.26-py3-none-any.whl
Algorithm Hash digest
SHA256 16dbdfddcd801248153359658b37b6130d66ffefff6eda399b015d9e5c5a92bb
MD5 000dd3971a72f185a2d44f15e5650b3c
BLAKE2b-256 fb0faa106e1b521138de405fa9c6700c3f8ed496d8690388f08cbf15bfce1dd3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page