memorylayer-py 0.1.0__tar.gz → 0.1.1__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.
Files changed (33) hide show
  1. memorylayer_py-0.1.1/LICENSE +21 -0
  2. memorylayer_py-0.1.1/MANIFEST.in +3 -0
  3. memorylayer_py-0.1.1/PKG-INFO +215 -0
  4. memorylayer_py-0.1.1/README.md +179 -0
  5. memorylayer_py-0.1.1/pyproject.toml +50 -0
  6. memorylayer_py-0.1.1/setup.py +46 -0
  7. memorylayer_py-0.1.1/src/memorylayer_py.egg-info/PKG-INFO +215 -0
  8. memorylayer_py-0.1.1/src/memorylayer_py.egg-info/SOURCES.txt +17 -0
  9. memorylayer_py-0.1.1/src/memorylayer_py.egg-info/requires.txt +7 -0
  10. memorylayer_py-0.1.1/src/rec0/__init__.py +16 -0
  11. memorylayer_py-0.1.1/src/rec0/client.py +141 -0
  12. memorylayer_py-0.1.1/src/rec0/exceptions.py +18 -0
  13. memorylayer_py-0.1.1/src/rec0/init.py +6 -0
  14. memorylayer_py-0.1.1/src/rec0/version.py +2 -0
  15. memorylayer_py-0.1.1/tests/test_client.py +72 -0
  16. memorylayer_py-0.1.1/tests/test_integration.py +21 -0
  17. memorylayer_py-0.1.0/PKG-INFO +0 -241
  18. memorylayer_py-0.1.0/README.md +0 -212
  19. memorylayer_py-0.1.0/memorylayer_py.egg-info/PKG-INFO +0 -241
  20. memorylayer_py-0.1.0/memorylayer_py.egg-info/SOURCES.txt +0 -15
  21. memorylayer_py-0.1.0/memorylayer_py.egg-info/requires.txt +0 -7
  22. memorylayer_py-0.1.0/pyproject.toml +0 -42
  23. memorylayer_py-0.1.0/rec0/__init__.py +0 -30
  24. memorylayer_py-0.1.0/rec0/async_client.py +0 -201
  25. memorylayer_py-0.1.0/rec0/client.py +0 -232
  26. memorylayer_py-0.1.0/rec0/exceptions.py +0 -31
  27. memorylayer_py-0.1.0/rec0/models.py +0 -61
  28. memorylayer_py-0.1.0/rec0/version.py +0 -1
  29. memorylayer_py-0.1.0/tests/test_client.py +0 -180
  30. memorylayer_py-0.1.0/tests/test_integration.py +0 -93
  31. {memorylayer_py-0.1.0 → memorylayer_py-0.1.1}/setup.cfg +0 -0
  32. {memorylayer_py-0.1.0 → memorylayer_py-0.1.1/src}/memorylayer_py.egg-info/dependency_links.txt +0 -0
  33. {memorylayer_py-0.1.0 → memorylayer_py-0.1.1/src}/memorylayer_py.egg-info/top_level.txt +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yash Patel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include src *.py
@@ -0,0 +1,215 @@
1
+ Metadata-Version: 2.4
2
+ Name: memorylayer-py
3
+ Version: 0.1.1
4
+ Summary: Privacy-first memory API for LLMs
5
+ Home-page: https://github.com/patelyash2511/rec0-python
6
+ Author: rec0
7
+ Author-email: rec0 <support@rec0.vercel.app>
8
+ License: MIT
9
+ Project-URL: Homepage, https://rec0.vercel.app
10
+ Project-URL: Documentation, https://rec0.vercel.app/docs
11
+ Project-URL: Repository, https://github.com/patelyash2511/rec0-python
12
+ Project-URL: Bug Tracker, https://github.com/patelyash2511/rec0-python/issues
13
+ Keywords: ai,memory,sdk,rec0,llm
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: requests>=2.28.0
27
+ Requires-Dist: httpx>=0.24.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
30
+ Requires-Dist: black>=22.0.0; extra == "dev"
31
+ Requires-Dist: mypy>=0.950; extra == "dev"
32
+ Dynamic: author
33
+ Dynamic: home-page
34
+ Dynamic: license-file
35
+ Dynamic: requires-python
36
+
37
+ # rec0 Python SDK
38
+
39
+ Official Python client library for [rec0](https://rec0.vercel.app) - Persistent memory infrastructure for AI applications.
40
+
41
+ [![PyPI version](https://badge.fury.io/py/memorylayer-py.svg)](https://pypi.org/project/memorylayer-py/)
42
+ [![Tests](https://github.com/patelyash2511/rec0-python/workflows/tests/badge.svg)](https://github.com/patelyash2511/rec0-python/actions)
43
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
44
+
45
+ ## Quick Start
46
+
47
+ ```python
48
+ from rec0 import Memory
49
+
50
+ # Initialize with your API key
51
+ mem = Memory(
52
+ api_key='r0_live_sk_...',
53
+ user_id='user_123'
54
+ )
55
+
56
+ # Store a memory
57
+ mem.store("User prefers dark mode and Italian food")
58
+
59
+ # Recall relevant memories
60
+ context = mem.recall(query="user preferences")
61
+ print(context)
62
+ # Returns: "User prefers dark mode and Italian food"
63
+ ```
64
+
65
+ ## Install
66
+
67
+ ```bash
68
+ pip install memorylayer-py
69
+ ```
70
+
71
+ **Note:** The package name is `memorylayer-py` but you import it as `rec0`:
72
+
73
+ ```python
74
+ from rec0 import Memory # Import name is 'rec0', not 'memorylayer'
75
+ ```
76
+
77
+ ## Get Your API Key
78
+
79
+ 1. Sign up at [rec0.vercel.app](https://rec0.vercel.app)
80
+ 2. Get your API key from the dashboard
81
+ 3. Start building!
82
+
83
+ ## Documentation
84
+
85
+ - [Quick Start Guide](docs/quickstart.md)
86
+ - [API Reference](docs/api_reference.md)
87
+ - [Examples](docs/examples.md)
88
+ - [Full Documentation](https://rec0.vercel.app/docs)
89
+
90
+ ## Features
91
+
92
+ - **Auto-Capture**: Automatically extracts entities, facts, and preferences
93
+ - **Smart Retrieval**: Hybrid BM25 + cosine similarity search
94
+ - **Memory Decay**: Intelligent aging and conflict resolution
95
+ - **Privacy-first**: Per-user encryption, data isolation, and GDPR-compliant deletion. Your users' data is encrypted and never shared with third parties.
96
+ - **LLM-Agnostic**: Works with any LLM (OpenAI, Anthropic, Google, local models)
97
+
98
+ ## rec0 vs Mem0
99
+
100
+ | rec0 | Mem0 |
101
+ |------|------|
102
+ | Privacy: Per-user encryption & isolation | Standard cloud storage |
103
+
104
+ ## Enterprise Deployment
105
+
106
+ The Python SDK is fully open source (MIT license). The backend API is
107
+ closed source but available for enterprise on-premise deployment.
108
+
109
+ For self-hosted deployments, contact: enterprise@rec0.vercel.app
110
+
111
+ ## Examples
112
+
113
+ ### Basic Usage
114
+
115
+ ```python
116
+ from rec0 import Memory
117
+
118
+ mem = Memory(api_key='r0_...', user_id='user_123')
119
+
120
+ # Store
121
+ mem.store("User is a Python developer")
122
+
123
+ # Recall
124
+ context = mem.recall(query="programming")
125
+ ```
126
+
127
+ ### AI Chatbot with Memory
128
+
129
+ ```python
130
+ from rec0 import Memory
131
+ from openai import OpenAI
132
+
133
+ mem = Memory(api_key='r0_...', user_id='user_456')
134
+ ai = OpenAI()
135
+
136
+ # Get relevant context
137
+ context = mem.recall(query=user_message)
138
+
139
+ # Send to LLM with context
140
+ response = ai.chat.completions.create(
141
+ model="gpt-4",
142
+ messages=[
143
+ {"role": "system", "content": f"Context: {context}"},
144
+ {"role": "user", "content": user_message}
145
+ ]
146
+ )
147
+
148
+ # Store the conversation
149
+ mem.store(f"User: {user_message}\nAssistant: {response}")
150
+ ```
151
+
152
+ See [examples/](examples/) for more.
153
+
154
+ ## API Reference
155
+
156
+ ### `Memory(api_key, user_id, app_id=None, base_url=None)`
157
+
158
+ Initialize the memory client.
159
+
160
+ **Parameters:**
161
+ - `api_key` (str): Your rec0 API key
162
+ - `user_id` (str): Unique identifier for the user
163
+ - `app_id` (str, optional): Application identifier
164
+ - `base_url` (str, optional): Custom API endpoint
165
+
166
+ ### `store(content, metadata=None)`
167
+
168
+ Store a memory.
169
+
170
+ **Parameters:**
171
+ - `content` (str): The content to remember
172
+ - `metadata` (dict, optional): Additional metadata
173
+
174
+ **Returns:** `dict` with `memory_id`
175
+
176
+ ### `recall(query, limit=10)`
177
+
178
+ Retrieve relevant memories.
179
+
180
+ **Parameters:**
181
+ - `query` (str): Search query
182
+ - `limit` (int): Maximum number of results
183
+
184
+ **Returns:** `list` of memory objects
185
+
186
+ ### `delete(memory_id=None, user_id=None)`
187
+
188
+ Delete memories.
189
+
190
+ **Parameters:**
191
+ - `memory_id` (str, optional): Specific memory to delete
192
+ - `user_id` (str, optional): Delete all memories for user
193
+
194
+ ## Contributing
195
+
196
+ Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
197
+
198
+ ## License
199
+
200
+ MIT License - see [LICENSE](LICENSE) file for details.
201
+
202
+ ## Links
203
+
204
+ - [rec0.vercel.app](https://rec0.vercel.app)
205
+ - [GitHub](https://github.com/patelyash2511/rec0-python)
206
+ - [Docs](https://rec0.vercel.app/docs)
207
+
208
+ ## Support
209
+
210
+ - GitHub Issues: [Report bugs](https://github.com/patelyash2511/rec0-python/issues)
211
+ - Email: support@rec0.vercel.app
212
+
213
+ ---
214
+
215
+ Made with ❤️ by [rec0](https://rec0.vercel.app)
@@ -0,0 +1,179 @@
1
+ # rec0 Python SDK
2
+
3
+ Official Python client library for [rec0](https://rec0.vercel.app) - Persistent memory infrastructure for AI applications.
4
+
5
+ [![PyPI version](https://badge.fury.io/py/memorylayer-py.svg)](https://pypi.org/project/memorylayer-py/)
6
+ [![Tests](https://github.com/patelyash2511/rec0-python/workflows/tests/badge.svg)](https://github.com/patelyash2511/rec0-python/actions)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ## Quick Start
10
+
11
+ ```python
12
+ from rec0 import Memory
13
+
14
+ # Initialize with your API key
15
+ mem = Memory(
16
+ api_key='r0_live_sk_...',
17
+ user_id='user_123'
18
+ )
19
+
20
+ # Store a memory
21
+ mem.store("User prefers dark mode and Italian food")
22
+
23
+ # Recall relevant memories
24
+ context = mem.recall(query="user preferences")
25
+ print(context)
26
+ # Returns: "User prefers dark mode and Italian food"
27
+ ```
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ pip install memorylayer-py
33
+ ```
34
+
35
+ **Note:** The package name is `memorylayer-py` but you import it as `rec0`:
36
+
37
+ ```python
38
+ from rec0 import Memory # Import name is 'rec0', not 'memorylayer'
39
+ ```
40
+
41
+ ## Get Your API Key
42
+
43
+ 1. Sign up at [rec0.vercel.app](https://rec0.vercel.app)
44
+ 2. Get your API key from the dashboard
45
+ 3. Start building!
46
+
47
+ ## Documentation
48
+
49
+ - [Quick Start Guide](docs/quickstart.md)
50
+ - [API Reference](docs/api_reference.md)
51
+ - [Examples](docs/examples.md)
52
+ - [Full Documentation](https://rec0.vercel.app/docs)
53
+
54
+ ## Features
55
+
56
+ - **Auto-Capture**: Automatically extracts entities, facts, and preferences
57
+ - **Smart Retrieval**: Hybrid BM25 + cosine similarity search
58
+ - **Memory Decay**: Intelligent aging and conflict resolution
59
+ - **Privacy-first**: Per-user encryption, data isolation, and GDPR-compliant deletion. Your users' data is encrypted and never shared with third parties.
60
+ - **LLM-Agnostic**: Works with any LLM (OpenAI, Anthropic, Google, local models)
61
+
62
+ ## rec0 vs Mem0
63
+
64
+ | rec0 | Mem0 |
65
+ |------|------|
66
+ | Privacy: Per-user encryption & isolation | Standard cloud storage |
67
+
68
+ ## Enterprise Deployment
69
+
70
+ The Python SDK is fully open source (MIT license). The backend API is
71
+ closed source but available for enterprise on-premise deployment.
72
+
73
+ For self-hosted deployments, contact: enterprise@rec0.vercel.app
74
+
75
+ ## Examples
76
+
77
+ ### Basic Usage
78
+
79
+ ```python
80
+ from rec0 import Memory
81
+
82
+ mem = Memory(api_key='r0_...', user_id='user_123')
83
+
84
+ # Store
85
+ mem.store("User is a Python developer")
86
+
87
+ # Recall
88
+ context = mem.recall(query="programming")
89
+ ```
90
+
91
+ ### AI Chatbot with Memory
92
+
93
+ ```python
94
+ from rec0 import Memory
95
+ from openai import OpenAI
96
+
97
+ mem = Memory(api_key='r0_...', user_id='user_456')
98
+ ai = OpenAI()
99
+
100
+ # Get relevant context
101
+ context = mem.recall(query=user_message)
102
+
103
+ # Send to LLM with context
104
+ response = ai.chat.completions.create(
105
+ model="gpt-4",
106
+ messages=[
107
+ {"role": "system", "content": f"Context: {context}"},
108
+ {"role": "user", "content": user_message}
109
+ ]
110
+ )
111
+
112
+ # Store the conversation
113
+ mem.store(f"User: {user_message}\nAssistant: {response}")
114
+ ```
115
+
116
+ See [examples/](examples/) for more.
117
+
118
+ ## API Reference
119
+
120
+ ### `Memory(api_key, user_id, app_id=None, base_url=None)`
121
+
122
+ Initialize the memory client.
123
+
124
+ **Parameters:**
125
+ - `api_key` (str): Your rec0 API key
126
+ - `user_id` (str): Unique identifier for the user
127
+ - `app_id` (str, optional): Application identifier
128
+ - `base_url` (str, optional): Custom API endpoint
129
+
130
+ ### `store(content, metadata=None)`
131
+
132
+ Store a memory.
133
+
134
+ **Parameters:**
135
+ - `content` (str): The content to remember
136
+ - `metadata` (dict, optional): Additional metadata
137
+
138
+ **Returns:** `dict` with `memory_id`
139
+
140
+ ### `recall(query, limit=10)`
141
+
142
+ Retrieve relevant memories.
143
+
144
+ **Parameters:**
145
+ - `query` (str): Search query
146
+ - `limit` (int): Maximum number of results
147
+
148
+ **Returns:** `list` of memory objects
149
+
150
+ ### `delete(memory_id=None, user_id=None)`
151
+
152
+ Delete memories.
153
+
154
+ **Parameters:**
155
+ - `memory_id` (str, optional): Specific memory to delete
156
+ - `user_id` (str, optional): Delete all memories for user
157
+
158
+ ## Contributing
159
+
160
+ Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
161
+
162
+ ## License
163
+
164
+ MIT License - see [LICENSE](LICENSE) file for details.
165
+
166
+ ## Links
167
+
168
+ - [rec0.vercel.app](https://rec0.vercel.app)
169
+ - [GitHub](https://github.com/patelyash2511/rec0-python)
170
+ - [Docs](https://rec0.vercel.app/docs)
171
+
172
+ ## Support
173
+
174
+ - GitHub Issues: [Report bugs](https://github.com/patelyash2511/rec0-python/issues)
175
+ - Email: support@rec0.vercel.app
176
+
177
+ ---
178
+
179
+ Made with ❤️ by [rec0](https://rec0.vercel.app)
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "memorylayer-py"
7
+ version = "0.1.1"
8
+ description = "Privacy-first memory API for LLMs"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ authors = [
12
+ { name = "rec0", email = "support@rec0.vercel.app" }
13
+ ]
14
+ license = { text = "MIT" }
15
+ keywords = ["ai", "memory", "sdk", "rec0", "llm"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.9",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Topic :: Software Development :: Libraries :: Python Modules",
26
+ ]
27
+ dependencies = [
28
+ "requests>=2.28.0",
29
+ "httpx>=0.24.0",
30
+ ]
31
+
32
+ [project.optional-dependencies]
33
+ dev = [
34
+ "pytest>=7.0.0",
35
+ "black>=22.0.0",
36
+ "mypy>=0.950",
37
+ ]
38
+
39
+ [project.urls]
40
+ Homepage = "https://rec0.vercel.app"
41
+ Documentation = "https://rec0.vercel.app/docs"
42
+ Repository = "https://github.com/patelyash2511/rec0-python"
43
+ "Bug Tracker" = "https://github.com/patelyash2511/rec0-python/issues"
44
+
45
+ [tool.pytest.ini_options]
46
+ testpaths = ["tests"]
47
+ pythonpath = ["src"]
48
+ markers = [
49
+ "integration: integration tests that require external API credentials",
50
+ ]
@@ -0,0 +1,46 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ with open("README.md", "r", encoding="utf-8") as fh:
4
+ long_description = fh.read()
5
+
6
+ setup(
7
+ name="memorylayer-py",
8
+ version="0.1.1",
9
+ author="rec0",
10
+ author_email="support@rec0.vercel.app",
11
+ description="Privacy-first memory API for LLMs",
12
+ long_description=long_description,
13
+ long_description_content_type="text/markdown",
14
+ url="https://github.com/patelyash2511/rec0-python",
15
+ project_urls={
16
+ "Homepage": "https://rec0.vercel.app",
17
+ "Documentation": "https://rec0.vercel.app/docs",
18
+ "Bug Tracker": "https://github.com/patelyash2511/rec0-python/issues",
19
+ "Repository": "https://github.com/patelyash2511/rec0-python",
20
+ },
21
+ package_dir={"": "src"},
22
+ packages=find_packages(where="src"),
23
+ classifiers=[
24
+ "Development Status :: 4 - Beta",
25
+ "Intended Audience :: Developers",
26
+ "License :: OSI Approved :: MIT License",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3.9",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Topic :: Software Development :: Libraries :: Python Modules",
33
+ ],
34
+ python_requires=">=3.9",
35
+ install_requires=[
36
+ "requests>=2.28.0",
37
+ "httpx>=0.24.0",
38
+ ],
39
+ extras_require={
40
+ "dev": [
41
+ "pytest>=7.0.0",
42
+ "black>=22.0.0",
43
+ "mypy>=0.950",
44
+ ]
45
+ },
46
+ )