Skip to main content

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


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 details)

Uploaded Source

File details

Details for the file agentmemory-0.1.8.tar.gz.

File metadata

  • Download URL: agentmemory-0.1.8.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for agentmemory-0.1.8.tar.gz
Algorithm Hash digest
SHA256 4eded16a6ff6b6fd525370b0378b271c87f1c895bf1683beccb5a43fbfe20f4a
MD5 dbac228ac91305a101b8bfffde5ebb08
BLAKE2b-256 d5e073a62722e6a7186f411f0a8a07b12f2b5e607a0da091644a19bfe1dd8821

See more details on using hashes here.

Supported by

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