Skip to main content

Persistent memory store for LLM agents. Python bindings to the Rust lethe core.

Project description

lethe-memory

Python bindings to the Rust core of lethe, a self-improving memory store for LLM agents. Built with PyO3 + maturin, distributed as wheels.

Install

pip install lethe-memory

Use

from lethe_memory import MemoryStore

store = MemoryStore("./my_memories")  # encoders default to MiniLM

store.add("I prefer window seats on flights",      session_id="trip")
store.add("My wife needs aisle seats",             session_id="trip")
store.add("I work at Google as a software engineer", session_id="work")

for hit in store.retrieve("What are my travel preferences?", k=5):
    print(f"  [{hit.score:.1f}] {hit.content}")

store.save()

The wheel ships the Rust lethe-core retrieval pipeline (BM25 + dense hybrid, cross-encoder rerank, clustered RIF), the same code path the CLI uses, exposed via PyO3 with Python::allow_threads around all native work so multi-threaded Python callers see real parallelism.

Constructor knobs

MemoryStore(
    path,
    bi_encoder="Xenova/all-MiniLM-L6-v2",
    cross_encoder="Xenova/ms-marco-MiniLM-L-6-v2",
    rif_config=None,                # RIFConfig(n_clusters=30, ...)
    k_shallow=30,
    k_deep=100,
    confidence_threshold=4.0,
    dedup_threshold=0.95,
)

See also

License: MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

lethe_memory-0.11.0-cp39-abi3-win_arm64.whl (23.2 MB view details)

Uploaded CPython 3.9+Windows ARM64

lethe_memory-0.11.0-cp39-abi3-win_amd64.whl (23.1 MB view details)

Uploaded CPython 3.9+Windows x86-64

lethe_memory-0.11.0-cp39-abi3-macosx_11_0_arm64.whl (44.3 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file lethe_memory-0.11.0-cp39-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for lethe_memory-0.11.0-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 9faee49cb33f2684f19fbe47092e9ca677ef35f7809c36c3b6e292e9632abdcc
MD5 c804fdeef144ee3dd907c3530e63dbdd
BLAKE2b-256 03d1270df240ed1e57be872cee763f01ef7dde30e07f62d438c3ec569ca45556

See more details on using hashes here.

Provenance

The following attestation bundles were made for lethe_memory-0.11.0-cp39-abi3-win_arm64.whl:

Publisher: release-pypi.yml on teimurjan/lethe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lethe_memory-0.11.0-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for lethe_memory-0.11.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ac30fad1bf181e725133a327a004c9f74eebc573eb3ce705c6365a97de8c0778
MD5 9970f164b08bf2c1b659f4a591b5c49e
BLAKE2b-256 31453565d06524189c052c1c23c66085cc8d094532a4d7d1feebd37f26140146

See more details on using hashes here.

Provenance

The following attestation bundles were made for lethe_memory-0.11.0-cp39-abi3-win_amd64.whl:

Publisher: release-pypi.yml on teimurjan/lethe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lethe_memory-0.11.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lethe_memory-0.11.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2df505fdceeaa07f57b0b5bc576298f5a248604c703ae628c3f3884d516dc3ac
MD5 806db1f66a74137b240b7647014dcb73
BLAKE2b-256 0425cf8401df4cab34db5c2dadf1d6575ebe5d1b785ce8f7a8f086785ba8ce4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lethe_memory-0.11.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on teimurjan/lethe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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