Metadata-Version: 2.5
Name: mem0-kronotop
Version: 0.2.0
Summary: Kronotop backend for mem0
Project-URL: Homepage, https://kronotop.com
Project-URL: Documentation, https://github.com/kronotop/kronotop-py
Project-URL: Repository, https://github.com/kronotop/kronotop-py
Project-URL: Issues, https://github.com/kronotop/kronotop-py/issues
Author-email: Burak Sezer <burak.sezer@kronotop.com>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: client,database,kronotop,mem0,memory
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Database :: Front-Ends
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: kronotop-py>=0.2.0
Requires-Dist: mem0ai>=2.2.0
Description-Content-Type: text/markdown

# mem0-kronotop

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Kronotop backend for [mem0](https://github.com/mem0ai/mem0), built on [kronotop-py](https://github.com/kronotop/kronotop-py).

## Install

```bash
pip install mem0-kronotop
```

## Usage

Call `register()` before the first `Memory`. It adds the `kronotop` provider to mem0.

```python
from mem0 import Memory

from mem0_kronotop import register

register()

memory = Memory.from_config(
    {
        "vector_store": {
            "provider": "kronotop",
            "config": {
                "bootstrap": ["localhost:5484", "localhost:5485"],
                "namespace": "mem0",
                "collection_name": "mem0",
                "embedding_model_dims": 1536,
            },
        }
    }
)
```

`bootstrap` lists the members the client starts from, and defaults to
`localhost:5484`. The other three values above are the defaults. The store
creates the namespace and the bucket when they are missing.

`config` also takes the keyword arguments of the `Kronotop` client, such as
`password` and `ssl`.

## Example

The program below is a support assistant that remembers what a customer said.
mem0 uses OpenAI for the language model and the embeddings by default, so set
`OPENAI_API_KEY` before you run it.

```python
from mem0 import Memory

from mem0_kronotop import register

register()

memory = Memory.from_config(
    {
        "vector_store": {
            "provider": "kronotop",
            "config": {
                "bootstrap": ["localhost:5484"],
                "namespace": "support",
                "collection_name": "customers",
            },
        }
    }
)

# mem0 reads the conversation and stores the facts it finds.
memory.add(
    [
        {"role": "user", "content": "My order arrived broken. I want a refund."},
        {"role": "assistant", "content": "Sorry about that. I opened a refund."},
        {"role": "user", "content": "Thanks. Please write to me by email only."},
    ],
    user_id="alice",
)

# Later, in another conversation.
found = memory.search("How should we contact her?", filters={"user_id": "alice"})
for result in found["results"]:
    print(result["score"], result["memory"])

# Everything mem0 knows about one customer.
for result in memory.get_all(filters={"user_id": "alice"})["results"]:
    print(result["id"], result["memory"])

memory.delete(found["results"][0]["id"])
```

Kronotop has no full-text search, so mem0 ranks by vector similarity alone.

## Tests

The tests are in the [kronotop-py](https://github.com/kronotop/kronotop-py)
repository, where this package is a uv workspace member. Run them from the
repository root:

```bash
uv sync --all-packages
uv run pytest packages/mem0-kronotop/tests
```

The store tests need a Kronotop at `kronotop://localhost:5484` and are skipped
when none is running. The other tests need no server. `--kronotop-url` points
them at another server:

```bash
uv run pytest packages/mem0-kronotop/tests --kronotop-url kronotop://192.168.1.10:5484
```

## License

Apache License 2.0. See [LICENSE](LICENSE).
