Metadata-Version: 2.4
Name: deepmem-client
Version: 0.1.0
Summary: Drop-in Mem0-compatible client for the DeepMem cloud memory API. Switch from mem0 in one line.
Project-URL: Homepage, https://deepmem.dev
Project-URL: Documentation, https://github.com/deepmemteam/deepmem/tree/main/docs/guides
Project-URL: Repository, https://github.com/deepmemteam/deepmem
Project-URL: Issues, https://github.com/deepmemteam/deepmem/issues
Author-email: DeepMem <hello@deepmem.dev>
License-Expression: MIT
License-File: LICENSE
Keywords: agent,ai,deepmem,llm,mem0,memory,memory-layer
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
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: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: httpx>=0.24
Description-Content-Type: text/markdown

# deepmem-client

> Drop-in Mem0-compatible client for the **DeepMem cloud** memory API. Switch from Mem0 in one line - same class name, same method signatures, same `filters={"user_id": ...}` style as `mem0.MemoryClient`.

[![PyPI](https://img.shields.io/pypi/v/deepmem-client.svg)](https://pypi.org/project/deepmem-client/)
[![Python](https://img.shields.io/pypi/pyversions/deepmem-client.svg)](https://pypi.org/project/deepmem-client/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

`deepmem-client` is a **thin HTTP client** for the DeepMem cloud memory API
(`https://deepmem.dev`). It mirrors `mem0.MemoryClient`'s class name and method
signatures, so migrating an app from Mem0 is a one-line import change - no torch,
no Qdrant, no server to run. Just `pip install` and point it at your cloud key.

## Install

```bash
pip install deepmem-client
```

## The one-line switch

```python
# ── before: Mem0 cloud ──
from mem0 import MemoryClient
client = MemoryClient(api_key="m0-xxxxxxxx")
client.add(messages, user_id="alex")
client.search("What can Alex cook?", filters={"user_id": "alex"})
```

```python
# ── after: DeepMem cloud ──
from deepmem import MemoryClient          # ← only this line changes
client = MemoryClient(api_key="dm_live_xxxxxxxx")   # key at https://deepmem.dev
client.add(messages, user_id="alex")
client.search("What can Alex cook?", filters={"user_id": "alex"})   # identical
```

That's it. The class name (`MemoryClient`), method names, and the
`filters={"user_id": ...}` style all match `mem0.MemoryClient`, so the rest of
your code stays untouched. (`from deepmem import Memory` works too as an alias
for mem0's OSS `Memory` class, with `search(query, user_id=...)` style.)

Set the key via env and skip passing it each time:

```bash
export DEEPMEM_API_KEY=dm_live_xxxxxxxx
```
```python
from deepmem import mem0_client as client   # singleton, reads DEEPMEM_API_KEY / DEEPMEM_BASE_URL
client.add(messages, user_id="alex")
```

## Method reference (mirrors `mem0.MemoryClient`)

| Method | Signature |
|---|---|
| `add` | `add(messages, user_id=None, agent_id=None, run_id=None, metadata=None, filters=None, infer=True)` |
| `search` | `search(query, filters=None, limit=100)` → `{"results": [...]}` |
| `get_all` | `get_all(filters=None, limit=100)` → `{"count": int, "results": [...]}` |
| `get` | `get(memory_id)` |
| `update` | `update(memory_id, text)` |
| `delete` | `delete(memory_id)` |
| `delete_all` | `delete_all(user_id=None, filters=None)` |
| `reset` | `reset(user_id=None, filters=None)` |

`messages` may be a list of `{role, content}` dicts, a single dict, or a string
(just like mem0). `search` / `get_all` accept `filters={"user_id": "..."}` (mem0
style) or a top-level `user_id=` (convenience).

## Behavioral differences from Mem0 (read this)

These are inherent to DeepMem and can't be hidden behind the client:

1. **`add(infer=True)` is asynchronous on DeepMem cloud.** `add()` returns
   immediately with `pending=True` and `results=[]`; extracted facts land a few
   seconds later. (Mem0 cloud's `add` is also async - it returns `PENDING` - so
   this is actually symmetric.) Pass `infer=False` for **synchronous raw-text
   storage** that is immediately searchable (no fact extraction) - useful when
   you want `add` then `search` to work back-to-back.

2. **No graph relations.** DeepMem uses hybrid vector retrieval (vector + BM25 +
   time-decay), not a knowledge graph. `"relations"` is always `[]`.

3. **`reset` differs.** Mem0's `reset()` is account-wide (deletes ALL users);
   DeepMem's is per-`user_id` with a confirm guard, so this client's `reset`
   requires a `user_id` (arg / `filters` / default).

4. **Self-hosted?** Point the client at your own server:
   `MemoryClient(api_key=None, host="http://localhost:8000")`. Self-hosted DeepMem
   runs in open mode (no API key needed).

## License

MIT. The full DeepMem server (with LLM extraction, Qdrant, BGE-M3 embeddings,
MCP) is at [github.com/deepmemteam/deepmem](https://github.com/deepmemteam/deepmem).
