Name | threadmem JSON |
Version |
0.2.36
JSON |
| download |
home_page | None |
Summary | Thread memory for AI agents |
upload_time | 2024-12-12 19:23:25 |
maintainer | None |
docs_url | None |
author | Patrick Barker |
requires_python | <4.0,>=3.10 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<!-- PROJECT LOGO -->
<br />
<p align="center">
<!-- <a href="https://github.com/agentsea/skillpacks">
<img src="https://project-logo.png" alt="Logo" width="80">
</a> -->
<h1 align="center">threadmem</h1>
<p align="center">
Chat thread memory for AI agents
<br />
<a href="https://docs.hub.agentsea.ai/threadmem/intro"><strong>Explore the docs »</strong></a>
<br />
<br />
<a href="https://youtu.be/exoOUUwFRB8">View Demo</a>
·
<a href="https://github.com/agentsea/threadmem/issues">Report Bug</a>
·
<a href="https://github.com/agentsea/threadmem/issues">Request Feature</a>
</p>
<br>
</p>
ThreadMem is a simple tool that helps manage chat conversations with language models.
## Installation
```
pip install threadmem
```
## Usage
### Role Threads
Role based threads are useful for managing openai-style chat schemas.
```python
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()
```
Add images of any variety to the thread. We support base64, filepath, PIL, and URL:
```python
from PIL import Image
img1 = Image.open("img1.png")
thread.post(
role="user",
msg="Whats this image?",
images=["data:image/jpeg;base64,...", "./img1.png", img1, "https://shorturl.at/rVyAS"]
)
```
## Integrations
Threadmem is integrated into:
- [MLLM](https://github.com/agentsea/mllm) - A prompt management, routing, and schema validation library for multimodal LLMs.
- [Taskara](https://github.com/agentsea/taskara) - A task management library for AI agents.
- [Skillpacks](https://github.com/agentsea/skillpacks) - A library to fine tune AI agents on tasks.
- [SurfKit](https://github.com/agentsea/surfkit) - A platform for AI agents.
## Community
Come join us on [Discord](https://discord.gg/hhaq7XYPS6).
## 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:
```sh
DB_TYPE=postgres
DB_NAME=threads
DB_HOST=localhost
DB_USER=postgres
DB_PASS=abc123
```
Image storage by default will utilize the db, to configure bucket storage using GCS:
- Create a bucket with fine grained permissions
- Create a GCP service account JSON with permissions to write to the bucket
```sh
export THREAD_STORAGE_SA_JSON='{
"type": "service_account",
...
}'
export THREAD_STORAGE_BUCKET=my-bucket
```
## Develop
To test
```sh
make test
```
To publish
```sh
make publish
```
Raw data
{
"_id": null,
"home_page": null,
"name": "threadmem",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "Patrick Barker",
"author_email": "patrickbarkerco@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/72/14/96e923772140dc6654cb3f89117cb221232ff854cd9085cf1c5ad801c16d/threadmem-0.2.36.tar.gz",
"platform": null,
"description": "<!-- PROJECT LOGO -->\n<br />\n<p align=\"center\">\n <!-- <a href=\"https://github.com/agentsea/skillpacks\">\n <img src=\"https://project-logo.png\" alt=\"Logo\" width=\"80\">\n </a> -->\n\n <h1 align=\"center\">threadmem</h1>\n\n <p align=\"center\">\n Chat thread memory for AI agents\n <br />\n <a href=\"https://docs.hub.agentsea.ai/threadmem/intro\"><strong>Explore the docs \u00bb</strong></a>\n <br />\n <br />\n <a href=\"https://youtu.be/exoOUUwFRB8\">View Demo</a>\n \u00b7\n <a href=\"https://github.com/agentsea/threadmem/issues\">Report Bug</a>\n \u00b7\n <a href=\"https://github.com/agentsea/threadmem/issues\">Request Feature</a>\n </p>\n <br>\n</p>\n\nThreadMem is a simple tool that helps manage chat conversations with language models.\n\n## Installation\n\n```\npip install threadmem\n```\n\n## Usage\n\n### Role Threads\n\nRole based threads are useful for managing openai-style chat schemas.\n\n```python\nfrom threadmem import RoleThread\n\n# Create a thread storing it in a local sqlite db\nthread = RoleThread(owner_id=\"dolores@agentsea.ai\")\n\n# Post messages\nthread.post(\"user\", \"Hello, Thread!\")\nthread.post(\"assistant\", \"How can I help?\")\nthread.post(\"user\", \"Whats this image?\", images=[\"data:image/jpeg;base64,...\"])\n\n# Output in openai chat schema format\nprint(thread.to_oai())\n\n# Find a thread\nthreads = RoleThread.find(owner_id=\"dolores@agentsea.ai\")\n\n# Delete a thread\nthreads[0].delete()\n```\n\nAdd images of any variety to the thread. We support base64, filepath, PIL, and URL:\n\n```python\nfrom PIL import Image\n\nimg1 = Image.open(\"img1.png\")\n\nthread.post(\n role=\"user\",\n msg=\"Whats this image?\",\n images=[\"data:image/jpeg;base64,...\", \"./img1.png\", img1, \"https://shorturl.at/rVyAS\"]\n)\n```\n\n## Integrations\n\nThreadmem is integrated into:\n\n- [MLLM](https://github.com/agentsea/mllm) - A prompt management, routing, and schema validation library for multimodal LLMs.\n- [Taskara](https://github.com/agentsea/taskara) - A task management library for AI agents.\n- [Skillpacks](https://github.com/agentsea/skillpacks) - A library to fine tune AI agents on tasks.\n- [SurfKit](https://github.com/agentsea/surfkit) - A platform for AI agents.\n\n## Community\n\nCome join us on [Discord](https://discord.gg/hhaq7XYPS6).\n\n## Backends\n\nThread and prompt storage can be backed by:\n\n- Sqlite\n- Postgresql\n\nSqlite will be used by default. To use postgres simply configure the env vars:\n\n```sh\nDB_TYPE=postgres\nDB_NAME=threads\nDB_HOST=localhost\nDB_USER=postgres\nDB_PASS=abc123\n```\n\nImage storage by default will utilize the db, to configure bucket storage using GCS:\n\n- Create a bucket with fine grained permissions\n- Create a GCP service account JSON with permissions to write to the bucket\n\n```sh\nexport THREAD_STORAGE_SA_JSON='{\n \"type\": \"service_account\",\n ...\n}'\nexport THREAD_STORAGE_BUCKET=my-bucket\n```\n\n## Develop\n\nTo test\n\n```sh\nmake test\n```\n\nTo publish\n\n```sh\nmake publish\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Thread memory for AI agents",
"version": "0.2.36",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c40c551ae80d47c23b0315cff32968bb1d36cd3f4aee5d5fa2cd7abce04dcf51",
"md5": "cb730c8a2c739ee9584e68c18e6dc9dc",
"sha256": "841379d6d6615207325a7b3d72eb8ec1d80abc3be921f879823d07832ee6cb5b"
},
"downloads": -1,
"filename": "threadmem-0.2.36-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cb730c8a2c739ee9584e68c18e6dc9dc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 27854,
"upload_time": "2024-12-12T19:23:21",
"upload_time_iso_8601": "2024-12-12T19:23:21.740015Z",
"url": "https://files.pythonhosted.org/packages/c4/0c/551ae80d47c23b0315cff32968bb1d36cd3f4aee5d5fa2cd7abce04dcf51/threadmem-0.2.36-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "721496e923772140dc6654cb3f89117cb221232ff854cd9085cf1c5ad801c16d",
"md5": "6ab2cd9b8b365f687ed74c04536c868d",
"sha256": "fb63f47543c8060b033a6f9f008964cf9de793f09347e54601df156c5f395d6d"
},
"downloads": -1,
"filename": "threadmem-0.2.36.tar.gz",
"has_sig": false,
"md5_digest": "6ab2cd9b8b365f687ed74c04536c868d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 24436,
"upload_time": "2024-12-12T19:23:25",
"upload_time_iso_8601": "2024-12-12T19:23:25.725951Z",
"url": "https://files.pythonhosted.org/packages/72/14/96e923772140dc6654cb3f89117cb221232ff854cd9085cf1c5ad801c16d/threadmem-0.2.36.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-12 19:23:25",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "threadmem"
}