slashml-memory 1.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- slashml_memory-1.0.4/LICENSE +18 -0
- slashml_memory-1.0.4/PKG-INFO +81 -0
- slashml_memory-1.0.4/README.md +67 -0
- slashml_memory-1.0.4/pyproject.toml +31 -0
- slashml_memory-1.0.4/setup.cfg +4 -0
- slashml_memory-1.0.4/slashml/__init__.py +67 -0
- slashml_memory-1.0.4/slashml/__main__.py +11 -0
- slashml_memory-1.0.4/slashml/client.py +1175 -0
- slashml_memory-1.0.4/slashml/compat.py +129 -0
- slashml_memory-1.0.4/slashml/eval_cli.py +87 -0
- slashml_memory-1.0.4/slashml/integrations/__init__.py +27 -0
- slashml_memory-1.0.4/slashml/integrations/crewai.py +32 -0
- slashml_memory-1.0.4/slashml/integrations/langchain.py +107 -0
- slashml_memory-1.0.4/slashml/integrations/langgraph.py +82 -0
- slashml_memory-1.0.4/slashml/integrations/llamaindex.py +53 -0
- slashml_memory-1.0.4/slashml/mcp_server.py +1034 -0
- slashml_memory-1.0.4/slashml/py.typed +0 -0
- slashml_memory-1.0.4/slashml/repo_indexer.py +305 -0
- slashml_memory-1.0.4/slashml_memory.egg-info/PKG-INFO +81 -0
- slashml_memory-1.0.4/slashml_memory.egg-info/SOURCES.txt +22 -0
- slashml_memory-1.0.4/slashml_memory.egg-info/dependency_links.txt +1 -0
- slashml_memory-1.0.4/slashml_memory.egg-info/entry_points.txt +4 -0
- slashml_memory-1.0.4/slashml_memory.egg-info/requires.txt +1 -0
- slashml_memory-1.0.4/slashml_memory.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2026 SlashML, Inc.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: slashml-memory
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: / ml (SlashML): Sub-Millisecond Stateful Agent & Code Memory Python SDK
|
|
5
|
+
Author: SlashML Inc.
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://slashml.ai
|
|
8
|
+
Project-URL: Repository, https://github.com/slashml-ai/ml-memory
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: numpy>=1.24.0
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# `/ ml` (`slashml-memory`) Python SDK
|
|
16
|
+
|
|
17
|
+
Official thin HTTP Python SDK for **`/ ml` (`https://api.slashml.ai`)** — sub-millisecond stateful agent & code memory. Zero native binary or local model dependencies (`urllib.request` standard library).
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install slashml-memory
|
|
23
|
+
export SLASHML_API_KEY="sml_live_..."
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quickstart
|
|
27
|
+
|
|
28
|
+
### 1. Native `/ ml` Memory Client (`SlashMLMemory` / `MemoryClient`)
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from slashml import SlashMLMemory
|
|
32
|
+
|
|
33
|
+
client = SlashMLMemory(api_key="sml_live_...")
|
|
34
|
+
|
|
35
|
+
# Ingest text or source code
|
|
36
|
+
client.ingest(
|
|
37
|
+
documents=[
|
|
38
|
+
{"id": "doc_1", "text": "Production PostgreSQL runs on port 5432 with pgBouncer on 6432."}
|
|
39
|
+
],
|
|
40
|
+
user_id="alice",
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
# Query stored memories
|
|
44
|
+
hits = client.query("Which port does pgBouncer listen on?", user_id="alice", top_k=3)
|
|
45
|
+
print(hits["results"][0])
|
|
46
|
+
|
|
47
|
+
# Delete documents by ID
|
|
48
|
+
client.forget(["doc_1"], user_id="alice")
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 2. 1-Line `Mem0` Drop-In Replacement (`Memory` & `MemoryClient`)
|
|
52
|
+
|
|
53
|
+
Replace `from mem0 import MemoryClient` or `from mem0 import Memory` with `from slashml import MemoryClient, Memory`:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
# Before: from mem0 import MemoryClient
|
|
57
|
+
from slashml import MemoryClient
|
|
58
|
+
|
|
59
|
+
client = MemoryClient(api_key="sml_live_...")
|
|
60
|
+
|
|
61
|
+
client.add(
|
|
62
|
+
[{"role": "user", "content": "Always use uv and pytest -q for Python checks."}],
|
|
63
|
+
user_id="developer_1",
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
results = client.search("How should I run Python tests?", user_id="developer_1")
|
|
67
|
+
|
|
68
|
+
# 3. Evaluate an agent turn or tool action
|
|
69
|
+
decision = client.intervene(
|
|
70
|
+
"pip install pytest",
|
|
71
|
+
hook_event_name="PreToolUse",
|
|
72
|
+
tool_name="Bash",
|
|
73
|
+
user_id="developer_1",
|
|
74
|
+
)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 3. CLI & Ambient Hook Installation
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
python -m slashml.mcp_server --install-hooks --api-key "$SLASHML_API_KEY"
|
|
81
|
+
```
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# `/ ml` (`slashml-memory`) Python SDK
|
|
2
|
+
|
|
3
|
+
Official thin HTTP Python SDK for **`/ ml` (`https://api.slashml.ai`)** — sub-millisecond stateful agent & code memory. Zero native binary or local model dependencies (`urllib.request` standard library).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install slashml-memory
|
|
9
|
+
export SLASHML_API_KEY="sml_live_..."
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Quickstart
|
|
13
|
+
|
|
14
|
+
### 1. Native `/ ml` Memory Client (`SlashMLMemory` / `MemoryClient`)
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
from slashml import SlashMLMemory
|
|
18
|
+
|
|
19
|
+
client = SlashMLMemory(api_key="sml_live_...")
|
|
20
|
+
|
|
21
|
+
# Ingest text or source code
|
|
22
|
+
client.ingest(
|
|
23
|
+
documents=[
|
|
24
|
+
{"id": "doc_1", "text": "Production PostgreSQL runs on port 5432 with pgBouncer on 6432."}
|
|
25
|
+
],
|
|
26
|
+
user_id="alice",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Query stored memories
|
|
30
|
+
hits = client.query("Which port does pgBouncer listen on?", user_id="alice", top_k=3)
|
|
31
|
+
print(hits["results"][0])
|
|
32
|
+
|
|
33
|
+
# Delete documents by ID
|
|
34
|
+
client.forget(["doc_1"], user_id="alice")
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 2. 1-Line `Mem0` Drop-In Replacement (`Memory` & `MemoryClient`)
|
|
38
|
+
|
|
39
|
+
Replace `from mem0 import MemoryClient` or `from mem0 import Memory` with `from slashml import MemoryClient, Memory`:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
# Before: from mem0 import MemoryClient
|
|
43
|
+
from slashml import MemoryClient
|
|
44
|
+
|
|
45
|
+
client = MemoryClient(api_key="sml_live_...")
|
|
46
|
+
|
|
47
|
+
client.add(
|
|
48
|
+
[{"role": "user", "content": "Always use uv and pytest -q for Python checks."}],
|
|
49
|
+
user_id="developer_1",
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
results = client.search("How should I run Python tests?", user_id="developer_1")
|
|
53
|
+
|
|
54
|
+
# 3. Evaluate an agent turn or tool action
|
|
55
|
+
decision = client.intervene(
|
|
56
|
+
"pip install pytest",
|
|
57
|
+
hook_event_name="PreToolUse",
|
|
58
|
+
tool_name="Bash",
|
|
59
|
+
user_id="developer_1",
|
|
60
|
+
)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 3. CLI & Ambient Hook Installation
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
python -m slashml.mcp_server --install-hooks --api-key "$SLASHML_API_KEY"
|
|
67
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "slashml-memory"
|
|
7
|
+
version = "1.0.4"
|
|
8
|
+
description = "/ ml (SlashML): Sub-Millisecond Stateful Agent & Code Memory Python SDK"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = {text = "Apache-2.0"}
|
|
12
|
+
authors = [{name = "SlashML Inc."}]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"numpy>=1.24.0",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://slashml.ai"
|
|
19
|
+
Repository = "https://github.com/slashml-ai/ml-memory"
|
|
20
|
+
|
|
21
|
+
[project.scripts]
|
|
22
|
+
slashml-mcp = "slashml.mcp_server:main"
|
|
23
|
+
slashml-mcp-code = "slashml.mcp_server:main_code_only"
|
|
24
|
+
slashml-eval = "slashml.eval_cli:main"
|
|
25
|
+
|
|
26
|
+
[tool.setuptools]
|
|
27
|
+
packages = ["slashml", "slashml.integrations"]
|
|
28
|
+
include-package-data = true
|
|
29
|
+
|
|
30
|
+
[tool.setuptools.package-data]
|
|
31
|
+
slashml = ["py.typed"]
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""/ ml (`slashml`) Python SDK — Sub-Millisecond Stateful Agent & Code Memory.
|
|
2
|
+
|
|
3
|
+
Provides 100% Mem0-compatible `Memory` and `MemoryClient` alongside `SlashMLMemory` and `SlashMLClient`.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from slashml.client import (
|
|
7
|
+
DEFAULT_BASE_URL,
|
|
8
|
+
AsyncMemoryClient,
|
|
9
|
+
AsyncSlashMLClient,
|
|
10
|
+
AsyncSlashMLMemory,
|
|
11
|
+
MemoryClient,
|
|
12
|
+
SlashMLAPIError,
|
|
13
|
+
SlashMLClient,
|
|
14
|
+
SlashMLMemory,
|
|
15
|
+
)
|
|
16
|
+
from slashml.compat import AsyncMemory, Memory
|
|
17
|
+
from slashml.integrations import (
|
|
18
|
+
SlashMLChatMessageHistory,
|
|
19
|
+
SlashMLCrewAIMemory,
|
|
20
|
+
SlashMLLangChainRetriever,
|
|
21
|
+
SlashMLLangChainVectorStore,
|
|
22
|
+
SlashMLLangGraphCheckpointer,
|
|
23
|
+
SlashMLLangGraphStore,
|
|
24
|
+
SlashMLLlamaIndexRetriever,
|
|
25
|
+
SlashMLLlamaIndexVectorStore,
|
|
26
|
+
)
|
|
27
|
+
from slashml.mcp_server import (
|
|
28
|
+
SlashMLMCPServer,
|
|
29
|
+
install_ambient_hooks,
|
|
30
|
+
run_ambient_hook_mode,
|
|
31
|
+
)
|
|
32
|
+
from slashml.repo_indexer import (
|
|
33
|
+
RepositoryIndexer,
|
|
34
|
+
find_bug_candidates,
|
|
35
|
+
remap_memory_file_references,
|
|
36
|
+
search_code_by_behavior,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
__version__ = "1.0.4"
|
|
40
|
+
__all__ = [
|
|
41
|
+
"AsyncMemory",
|
|
42
|
+
"AsyncMemoryClient",
|
|
43
|
+
"AsyncSlashMLClient",
|
|
44
|
+
"AsyncSlashMLMemory",
|
|
45
|
+
"DEFAULT_BASE_URL",
|
|
46
|
+
"Memory",
|
|
47
|
+
"MemoryClient",
|
|
48
|
+
"RepositoryIndexer",
|
|
49
|
+
"SlashMLAPIError",
|
|
50
|
+
"SlashMLChatMessageHistory",
|
|
51
|
+
"SlashMLClient",
|
|
52
|
+
"SlashMLCrewAIMemory",
|
|
53
|
+
"SlashMLLangChainRetriever",
|
|
54
|
+
"SlashMLLangChainVectorStore",
|
|
55
|
+
"SlashMLLangGraphCheckpointer",
|
|
56
|
+
"SlashMLLangGraphStore",
|
|
57
|
+
"SlashMLLlamaIndexRetriever",
|
|
58
|
+
"SlashMLLlamaIndexVectorStore",
|
|
59
|
+
"SlashMLMCPServer",
|
|
60
|
+
"SlashMLMemory",
|
|
61
|
+
"__version__",
|
|
62
|
+
"find_bug_candidates",
|
|
63
|
+
"install_ambient_hooks",
|
|
64
|
+
"remap_memory_file_references",
|
|
65
|
+
"run_ambient_hook_mode",
|
|
66
|
+
"search_code_by_behavior",
|
|
67
|
+
]
|