Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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.
pip install threadmem
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()
Add images of any variety to the thread. We support base64, filepath, PIL, and URL:
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"]
)
Threadmem is integrated into:
Come join us on Discord.
Thread and prompt storage can be backed by:
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
Image storage by default will utilize the db, to configure bucket storage using GCS:
export THREAD_STORAGE_SA_JSON='{
"type": "service_account",
...
}'
export THREAD_STORAGE_BUCKET=my-bucket
To test
make test
To publish
make publish
FAQs
Thread memory for AI agents
We found that threadmem demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.